Hi, 

an opaque structure is not an FFIExternalObject but an FFIOpaqueObject. 
in that case, something like (simplified): 

ctx := (your context).
list := FFIOpaqueObject new.
size := self getDevice: ctx list: list.

getDevice: ctx list: list
        ^ self ffiCall: #(size_t libusb_get_device_list (libusb_context *ctx, 
FFIOpaqueObject ***list))

should work (note that of course you can make libusb_device an alias for your 
type… that does not matters much, this is just a simplification).

if this does not works, if you can provide me code to reproduce it, I can give 
it a shot and see what happens :)

Esteban

> On 01 Jul 2016, at 11:19, Julien Delplanque <jul...@tamere.eu> wrote:
> 
> Hello everyone,
> 
> I have a question about the UFFI API. I have the following function:
> 
> ssize_t libusb_get_device_list (libusb_context *ctx, libusb_device ***list)
> 
> where libusb_device is an opaque structure.
> 
> I made a type mapping "ssize_t" -> "int" and an object inheriting
> from FFIExternalObject for the "libusb_context" (others methods
> using it are working).
> 
> I can not find how to get an array filled with libusb_device using UFFI from 
> Pharo. :-(
> 
> Thanks in advance,
> 
> Julien
> 


Reply via email to