-
Notifications
You must be signed in to change notification settings - Fork 68
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
struct reflection #10
Comments
+1 |
This is available for simple structs (bitstypes and pointers only) if you set "WrapContext.options.wrap_structs = true". But the utility is kind of limited, because we can't pass structs by value or de-reference members in pure Julia yet. For supported structs, the output should be usable with StrPack by adding @struct in front of the type declaration, but you would still need to do the pack/unpack steps yourself around each call. When I looked through StrPack I didn't really see a consistent way to generate wrappers to do that, because you need to know some things about how the function will actually be called... but maybe I should look in to that again. |
I'm open to patches. Of course avoiding StrPack is going to be better when possible since using it will force a copy in each direction. I'm not sure what currently works or doesn't natively, and as I believe you are aware it's not obvious from the current issues on the topic. |
I should have phrased that differently, because the question of whether or not to strpack a particular pointer argument is kind of tangential to StrPack (context-specific and requires knowledge beyond just the fact that it is a pointer). |
Fixed-size arrays are supported here by pre-declaring a Need to do unions in a similar way by finding the largest element. |
closed in favor of #228 |
Generate Julia types to match C struct declarations
The text was updated successfully, but these errors were encountered: