-
-
Notifications
You must be signed in to change notification settings - Fork 224
Using a class from an external crate generate an extension conflict #1078
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
Comments
Can you elaborate your crate setup? Are the two crates both cdylib? Dependencies? |
For sure: crate_a cargo.toml:
crate_b cargo.tml:
I need to include "lib" in the crate type. Otherwise, crate_a cannot be referred to in crate_b. I think this might be the issue. Both crates have one declared class with some Without crate_b referring crate_a in |
Yes, indeed. There are some general problems with this setup in Rust, see e.g. "Problems" section in #986. But you'll find most information + some trade-offs in #951. In short, dependencies between libraries is a workflow that's not properly supported yet, and there are probably a few things we need to do to avoid errors like these. |
Thanks. |
All good, no worries! I agree it's an important topic 🙂 I'll close this in favor of #951 to keep things in one place, but in case you have more input on this topic in the future, feel free to comment there directly! |
I am trying to organize the code and avoid a huge library with the entire game and data logic in a single file.
Let's say I have a crate_a with a class/resource and a crate_b that needs to refer to this class for any reason.
Just by adding
use crate_a::class_name
in the crate_b library, it stops working. However, it compiles and runs the game.The error is: ERROR: Attempt to register extension class 'InputManager', which appears to be already registered.
My guess is that the class is being registered when the library_a is loaded and it is being registered again when library_b is loaded.
Is this a user error? How to avoid it?
The text was updated successfully, but these errors were encountered: