Re: [Pharo-users] UFFI C basic types passed-by-reference for output
On 15 November 2017 at 20:47, Esteban Lorenzano <[hidden email]> wrote:
On 15 Nov 2017, at 09:36, Ben Coman <[hidden email]> wrote:
On 15 November 2017 at 17:27, Esteban Lorenzano<[hidden email]>wrote:
> On 15 Nov 2017, at 02:05, Ben Coman <[hidden email]> wrote: > > What is the recommended way for a C basic type to be passed-by-reference to function wanting to use it for output. > For example 'width' & 'height' here in this library unction... > > In Pharo... > > FFIOpaqueObject subclass: #FPDF_DOCUMENT > > FPDF_GetPageSizeByIndex__document: document > page_index: page_index > width: width > height: height > ^self ffiCall: #(int FPDF_GetPageSizeByIndex( > FPDF_DOCUMENT *document, > int page_index, > FFIFloat64 * width, > FFIFloat64 * height))
what you need to do here is to pass a “buffer” to contain the width and height: