Nice, thanks a lot! Luc 2015-03-25 11:47 GMT+01:00 Udo Schneider <udo.schneider@homeaddress.de>:
Hi Luc,
Yepp will do. Time to write a blog entry again :-)
CU,
Udo
On 25/03/15 11:42, Luc Fabresse wrote:
Hi Udo,
Thanks to report your experience on TalkFFI. Can you also post a small step by step tutorial of what you did to generate the NB bindings ?
Thanks,
#Luc
2015-03-25 11:37 GMT+01:00 Udo Schneider <udo.schneider@homeaddress.de <mailto:udo.schneider@homeaddress.de>>:
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.Schneider@homeaddress.de <mailto:Udo.Schneider@homeaddress.de> <mailto:Udo.Schneider@__homeaddress.de <mailto:Udo.Schneider@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