Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returning struct from function (not pointer) - how to ? #42

Open
UffeJakobsen opened this issue Jul 6, 2014 · 2 comments
Open

returning struct from function (not pointer) - how to ? #42

UffeJakobsen opened this issue Jul 6, 2014 · 2 comments

Comments

@UffeJakobsen
Copy link

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

@mascarenhas
Copy link
Owner

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
#42.

@UffeJakobsen
Copy link
Author

Hi Fabio,
Thanks for your fast reply.
I'm targeting FreeBSD/Linux 64bit (amd64)
/Uffe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants