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
Can we support passing structs with array members? #113
Comments
Is there a work-around for this issue at the moment? I googled around and couldn't find an answer.
Using the following fails:
I am using the stub generation to generate my bindings and the build fails saying that libffi does not support passing arrays. Is there a solution/work around? The build works if I do:
but I don't think this is the correct way to handle this? |
Yes, stub generation supports structs with array members. There's a definition of such a struct in the testsuite: type triple
let triple : triple structure typ = structure "triple"
let elements = field triple "elements" (array 3 double)
let () = seal triple with a corresponding test that calls a C function. |
Sorry for the noise: I had made a silly mistake in my stub generation code and it's working now. Thanks! |
isn't fixed and I don't want to go into the troubles of stub gen
Currently
ctypes.foreign
doesn't support passing or returning structs with array members, since there's no direct support for adding array members to structs in libffi.If it's safe to assume that a struct with a member of type
T[n]
is passed in the same way as a struct with n members of typeT
, then we can add support by doing the equivalent of this: https://gist.github.com/TooTallNate/3797011.The text was updated successfully, but these errors were encountered: