-
Notifications
You must be signed in to change notification settings - Fork 120
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
Use ffigen for C-API bindings #146
Conversation
@greenrobot-team you can have a first look when it works for you. Tests crash at the moment but I don't expect many changes to get it fixed. |
Won't be able to complete my review until I'm back. Anyhow, most of what I've seen of the first commit seems straight forward. |
You might want to check the size of the pointers. They should be machine word size, unless instructed differently to the compiler :/ Struct padding (I assume no packing is applied) could also be an issue. Really cool tool. I didn't know about it until now. I tried writing my own this summer. I guess I could throw that away now. |
Thanks, I'm aware of that. I had to do some patching until it's resolved in ffigen |
…ffigen issue is resolved
So many code changes... Maybe walk me quickly through it tomorrow; e.g. what's generated and what not... Did you test this on a 32 bit system (in addition to 64 bit ofc); e.g. Android? |
It's +10,112 −1,483 LoC and I assume the generated code is most of that. Can you give a high level explanation why it's almost +9K net? Maybe some example? |
Could you point us to that patch you did? |
Yes, most of it is the generated code, the (hopefully temporary) patch file & objectbox.h, 9777 lines added altogether. The generated code is a lot larger then our manual code because it doesn't use templates (generics) which we used to reduce the amount of manual work (though it has made the code quite a bit less readable) and it is more type safe (all pointers now have types, like
Yes, tested the example app on the 32-bit android. We can't run our complete test-suite on device yet. |
Part of dart-archive/ffigen#139 - switches from manual binding definitions to
ffigen
generated code