alien
alien copied to clipboard
returning struct from function (not pointer) - how to ?
Hi,
I'm doing af alien ffi wrapper for some library. The library have a nasty habit of returning structs - like this:
struct version_info { int major; int minor; int micro; };
struct version_info some_library_get_version(void) { struct version_info ver;
ver.major = MAJOR_VERSION;
ver.minor = MINOR_VERSION;
ver.micro = MICRO_VERSION;
return ver;
}
How do I represent this through lua/alien ?
Thanks in advance
/Uffe
Hi Uffe,
Alien does not support this directly, but a workaround might be possible. What is the architecture (CPU and OS)?
Fabio Mascarenhas
On Sun, Jul 6, 2014 at 6:13 PM, Uffe Jakobsen [email protected] wrote:
Hi,
I'm doing af alien ffi wrapper for some library. The library have a nasty habit of returning structs - like this:
struct version_info { int major; int minor; int micro; };
struct version_info some_library_get_version(void) { struct version_info ver;
ver.major = MAJOR_VERSION; ver.minor = MINOR_VERSION; ver.micro = MICRO_VERSION;
return ver;
}
How do I represent this through lua/alien ?
Thanks in advance
/Uffe
— Reply to this email directly or view it on GitHub https://github.com/mascarenhas/alien/issues/42.
Hi Fabio, Thanks for your fast reply. I'm targeting FreeBSD/Linux 64bit (amd64) /Uffe