-
Notifications
You must be signed in to change notification settings - Fork 55
Improvements to generating code, support for typedef. #224
Conversation
…ed directly. Note: dependencies that are only part of Typedefs are currently ignored
Hey @dcharkes, this is probably the biggest PR since #2, please take your time to review this. I've tried to clarify the reasons for the changes in the above #224 (comment). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First round of comments. (This is mostly the public API/docs. I'll go through the implementation code later.)
test/code_generator_tests/expected_bindings/_expected_typealias_bindings.dart
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add tests that generate intptr_t
-> IntPtr()
now that we can recognize the typedefs. In the past we just saw the int32 or int64 of the underlying size correct? We should be able to now support this properly.
Did you see this @mannprerak2 ? |
Ah, my bad, didn't see this before. We already have support for IntPtr. Using the |
I must have misremembered that then. 😄 |
Well, you weren't than far. We are still using platform dependant types (Uint32 or Uint64) for types such as Do we have a cross platform solution for this in the working for dart:ffi? |
It's on the list, but I've been busy with other stuff. |
Closes dart-lang/native#359, Closes dart-lang/native#363
Context. - earlier, declarations that were used by another declaration were included even if the declaration that included it was removed due to it not being supported by dart:ffi
Contest - earlier, it was a bit complicated to target structs, since they could have multiple names (from typedefs). With typedef support users can target structs by their true name (or incase they are anonymous, by the first typedef that refers to them.
Context - earlier, we generated typedefs like
_c_func
and_dart_func
for specifying function type. This has now been replaced with an inline function type declaration. Note that if the user exposes a function pointer usingfunction->symbol-address
we still create a typedef for that, but not otherwise. Since these types are only referred to once, using inline types reduces the number of lines generated.Context - Typedefs in C are now directly mapped as it is when possible. Only typedefs that were referred somewhere are generated. Users can rename these and exclude generating them (referred typedefs only). If a typedef is excluded we simply use the underlying type.
/usr/lib64
to the default dynamic library search paths on Linux.