I have written Foreign Structures By Value (FSBV) to allow calling foreign functions while passing or returning structures by value. It uses CFFI and libffi. It currently provides two macros for users, fsbv:defcstruct and fsbv:foreign-funcall, which are used exactly like their CFFI counterparts. It works for small test cases I've tried, but probably could use some improvement.
If the keepers of CFFI are interested, I would be happy for it to be included in CFFI. In the meantime, it can be found here: http://repo.or.cz/w/fsbv.git
Thank you.
Liam
Hello Liam,
Sorry for the late reply.
On Sat, Apr 11, 2009 at 9:02 PM, Liam Healy lnp@healy.washington.dc.us wrote:
If the keepers of CFFI are interested, I would be happy for it to be included in CFFI. In the meantime, it can be found here: http://repo.or.cz/w/fsbv.git
This would indeed be nice to have in CFFI! I've registered this wishlist item in https://bugs.launchpad.net/cffi/+bug/622247.
Thanks for the response. FSBV has grown a bit since I sent that email, and I agree with the principals you put in the bug report; i.e., if it's integrated correctly into CFFI it shouldn't require (any?) extra macros. That is why I wrote the macros to be as close to the CFFI form. In order to avoid extra macros while maintaining a separate system, it might be possible to provide a hook in CFFI and then have FSBV bind that hook if it's loaded.
BTW you might want to correct FSVB -> FSBV in the bug report and tags (stands for "by value") otherwise searches might miss it.
Liam
On Sun, Aug 22, 2010 at 5:34 PM, Luís Oliveira luismbo@gmail.com wrote:
Hello Liam,
Sorry for the late reply.
On Sat, Apr 11, 2009 at 9:02 PM, Liam Healy lnp@healy.washington.dc.us wrote:
If the keepers of CFFI are interested, I would be happy for it to be included in CFFI. In the meantime, it can be found here: http://repo.or.cz/w/fsbv.git
This would indeed be nice to have in CFFI! I've registered this wishlist item in https://bugs.launchpad.net/cffi/+bug/622247.
-- Luís Oliveira http://r42.eu/~luis/
On Thu, Aug 26, 2010 at 2:40 AM, Liam Healy lnp@healy.washington.dc.us wrote:
Thanks for the response. FSBV has grown a bit since I sent that email, and I agree with the principals you put in the bug report; i.e., if it's integrated correctly into CFFI it shouldn't require (any?) extra macros. That is why I wrote the macros to be as close to the CFFI form. In order to avoid extra macros while maintaining a separate system, it might be possible to provide a hook in CFFI and then have FSBV bind that hook if it's loaded.
Indeed. I have added you to the cffi group at c-l.net so you can pursue this further. We can collaborate via launchpad or this mailing list, whichever you find more convenient.
As a side note, it'd be great to leverage libffi for other features such as long-long or perhaps even its closure API.
BTW you might want to correct FSVB -> FSBV in the bug report and tags (stands for "by value") otherwise searches might miss it.
Oops, should be fixed now.