I found the offending code. The original code is something like:

        struct libusb_bos_dev_capability_descriptor *dev_capability
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
        [] /* valid C99 code */
#else
        [0] /* non-standard, but usually working code */
#endif
;

This doesn't work with clang/TalkFFI. I assume based on the #defines it uses the C99 notation which doesn't work. "Hardcoding" it to the non-standard notation does work. E.g.:

        struct libusb_bos_dev_capability_descriptor *dev_capability
//#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
//      [] /* valid C99 code */
//#else
        [0] /* non-standard, but usually working code */
//#endif
;

It seems that this was the only showstopper as TalkFFI just generated a binding for the whole library w/o any problem.

I'll start experimenting now ...

CU,

Udo


On 24/03/15 17:33, kilon alios wrote:
If the library is big you can use TalkFFI (you will find it in
smalltalkhub) that automates the wrapping with nativeboost.

On Tue, Mar 24, 2015 at 4:58 PM, Udo Schneider
<udo.schnei...@homeaddress.de
<mailto:udo.schnei...@homeaddress.de>> wrote:

    I guess not :-)

    I'll try to wrap libUSB then.

    I assume the future-proof way to use "a" FFI framework is to use the
    NB notation? Do I remember correctly that the NB notation is
    supposed to remain the same although the backend will change to
    something more like traditional FFI?
    So using NB notation w/o relying on the code generation is safe,
    correct?

    CU,

    Udo



    On 23.03.2015 16:15, Udo Schneider wrote:

        All,

        does anybody have some code or plugin to access USB ports with
        Pharo?
        Maybe something using libUSB or OpenUSB?

        Thanks,

        Udo










Reply via email to