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

Array as function argument #33

Open
davispuh opened this issue Nov 8, 2014 · 2 comments
Open

Array as function argument #33

davispuh opened this issue Nov 8, 2014 · 2 comments

Comments

@davispuh
Copy link
Contributor

davispuh commented Nov 8, 2014

When I've callback defined as

#define COUNT 10
void (*cl)(int list[COUNT]);

swig produces

<attribute name="decl" value="f(a(COUNT).int)." id="19616" addr="0xbf61b8" />

and it appears

callback([ a(COUNT).int ], :void)

but it probably should be

callback([ [:int, 10] ], :void)

only that's not supported yet, see ffi/ffi#385

@davispuh
Copy link
Contributor Author

davispuh commented Nov 8, 2014

hmm, actually I noticed that I hadn't included file with that #define in .i file. So with that included, swig produces

<attribute name="decl" value="p.f(a(10).int)." id="13790" addr="0xb87770" />

and it appears as

callback([ :pointer ], :void),

which is ok I guess, but I think it would be nice if it could be converted to actual Ruby array, because now I loose it's size.

@dmlary
Copy link
Contributor

dmlary commented Nov 8, 2014

I'll keep an eye on that other issue, but there's not much we can do if the ffi gem doesn't support array size within the function parameters.

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