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

FFI: Static types for references to Nit objects from C code #2348

Closed
wants to merge 7 commits into from

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Dec 14, 2016

This PR brings back a feature from the old nitc, generated static C types for references to Nit objects in user C code. These types are used only when the Nit type doesn't have a direct association in C, like interfaces, standard classes and nullable types, but extern classes and primitive types still use their associated C types. These generated types are used as parameters and return type of extern methods, and in the signature of callbacks to Nit services.

The static types extends some of the static type safety from Nit to the user C code. It lets the C compiler detect some data manipulation errors.

These types are also used by the FFI with C++ and Objective-C.

Also fix the support of generic extern classes, update the style of some FFI code, and fix #2277.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Copy link
Contributor

@jcbrinfo jcbrinfo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

@privat privat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good but a lot of tests fail

@xymus
Copy link
Contributor Author

xymus commented Dec 19, 2016

There's an issue with the order of the generated code. I'll have to update support for callbacks from C, C++ and Objective-C.

@privat
Copy link
Member

privat commented Mar 1, 2017

test this please

@privat
Copy link
Member

privat commented Jul 19, 2019

too many conflicts now. :(

@privat privat closed this Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nitc: Clearly distinguish cname and c_name
3 participants