-
Notifications
You must be signed in to change notification settings - Fork 307
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
[Bug] "symbol new_uint_8_list
is already defined" when using String as parameter in multiple rust module
#511
Comments
Well I realized a underlying problem: If you execute codegen twice like that, it will generate two files that do not know each other, so common utility will be duplicated. The biggest problem is that, if you have a struct that is used in both files, you will see two same-name but different classes generated and they cannot be interchanged. Thus, I suggest to make a PR to fully solve this problem: Parse multiple files, instead of just one api.rs, into internal format (IR). |
@fzyzcjy |
It has multiple parts:
|
Mainly the parser. https://github.com/fzyzcjy/flutter_rust_bridge/blob/master/frb_codegen/src/parser/ . You may or may not need to change a bit of the glue https://github.com/fzyzcjy/flutter_rust_bridge/blob/master/frb_codegen/src/lib.rs, I guess. |
Where to put this shared structure? In another file? |
If you decide to output multiple .dart files, maybe need to be in another file. If only output one .dart file - thus no need to modify the generator at all - then no worries about this problem. |
Now, this issue is solved. Related doc: http://cjycode.com/flutter_rust_bridge/feature/multiple_files.html. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue. |
Describe the bug
For multiple separate rust modules, generating code with justfile like this:
Then adding gnererated dart file to
ffi.dart
:I got error:
error : symbol
new_uint_8_listis already defined [appPath]\build\windows\cargo-build_native.vcxproj]
.The direct reasion is that, in both rust modules,
String
as parameter are neeeded for both rust modules, so in both generated dart files,new_uint_8_list
are defined.How to avoid it?
Giving another flag like
exclude_sync_execution_mode_utility
, or letflutter_rust_bridge_codegen
decide automatically to generated no-conflict api? I prefer the latter one.Codegen logs with
RUST_LOG=debug
environment variableThe text was updated successfully, but these errors were encountered: