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

test Dart FFI gen tool against our C wrapper layer #10

Closed
blagoev opened this issue Feb 8, 2021 · 2 comments
Closed

test Dart FFI gen tool against our C wrapper layer #10

blagoev opened this issue Feb 8, 2021 · 2 comments
Assignees

Comments

@blagoev
Copy link
Contributor

blagoev commented Feb 8, 2021

No description provided.

@sync-by-unito
Copy link

sync-by-unito bot commented Jun 1, 2021

➤ Lubo Blagoev commented:

Ran the Dart ffigen on our C layer headers and found issues with "Array members not supported", Unions generation, and anonymous unions in structs. Also some function names that start with underscore are generated as private in the output dart file. Running on windows generates bindings for some Win32 functions but that can be skipped with the ffgen configuration

Here is the full output with Dart 2.12

[WARNING]: Removed All Struct Members from: realm_decimal128(realm_decimal128), Array members not supported
[WARNING]: Removed All Struct Members from: realm_object_id(realm_object_id), Array members not supported
[WARNING]: Removed All Struct Members from: realm_uuid(realm_uuid), Array members not supported
[WARNING]: Removed All Struct Members from realm_error(realm_error), struct member has an unsupported type.
[WARNING]: Generated declaration 'realm_from_native_ptr' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_get_native_ptr' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_get_schema_native' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_object_from_native_copy' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_object_from_native_move' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_object_get_native_ptr' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_list_from_native_copy' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_list_from_native_move' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_set_from_native_copy' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_set_from_native_move' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_dictionary_from_native_copy' start's with '' and therefore will be private.
[WARNING]: Generated declaration 'realm_dictionary_from_native_move' start's with '' and therefore will be private.

All of the issues above can be mitigated by using Dart 2.14 which is currently in Dev stage.

In order to fix the anonymous unions in structs a PR was pushed in core which allows naming the union by defining RLM_NO_ANON_UNIONS when running the dart ffigen.
This can be done using the --compiler-opts="-DRLM_NO_ANON_UNIONS"

There might be additional problems with the generated output which were not identified by this research

@sync-by-unito sync-by-unito bot closed this as completed Jun 1, 2021
@sync-by-unito
Copy link

sync-by-unito bot commented Jun 1, 2021

➤ Lubo Blagoev commented:

The initial research was completed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant