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

Issues with multiple extensions in the same project #463

Open
rktprof opened this issue May 8, 2024 · 2 comments
Open

Issues with multiple extensions in the same project #463

rktprof opened this issue May 8, 2024 · 2 comments

Comments

@rktprof
Copy link

rktprof commented May 8, 2024

I'm experiencing some strange things with having multiple SwiftGodot gdextensions in the same project

Godot 4.2.2
SwiftGodot 0.41.0

Both of the extensions, libGameCenter.dylib and libNetworking.dylib works when they are the only extension available. When I add the Networking extension the GameCenter extension is no longer accessible in the project and I can no longer access any of the classes.

The only error I get is

E 0:00:00:0509   _register_extension_class_internal: Attempt to register extension class 'NetworkBrowser', which appears to be already registered.
  <C++ Error>    Condition "ClassDB::class_exists(class_name)" is true.
  <C++ Source>   core/extension/gdextension.cpp:386 @ _register_extension_class_internal() 
E 0:00:00:0509   _register_extension_class_internal: Attempt to register extension class 'NetworkListener', which appears to be already registered.
  <C++ Error>    Condition "ClassDB::class_exists(class_name)" is true.
  <C++ Source>   core/extension/gdextension.cpp:386 @ _register_extension_class_internal()

NetworkBrowser & NetworkListener are the two classes defined in #initSwiftExtension for the Networking extension

Additionally, I think godot messes up some caching because if I remove the gamecenter.gdextension file (but keep libGameCenter.dylib in the folder) and run the game I get the same errors, but now the extension works

@rktprof rktprof changed the title Issues with multiple plugins in the same project Issues with multiple extensions in the same project May 8, 2024
@migueldeicaza
Copy link
Owner

Can you share the initSwiftExtension calls you are using?

@rktprof
Copy link
Author

rktprof commented May 9, 2024

Can you share the initSwiftExtension calls you are using?

#initSwiftExtension(cdecl: "networking_init", types: [
	LocalNetworkListener.self,
	LocalNetworkDiscovery.self,
	])

(I renamed the Networking ones since initially posting this issue)

#initSwiftExtension(cdecl: "gamecenter_init", types: [
	GameCenter.self,
	GameCenterFriends.self,
	GameCenterLeaderboards.self,
	GameCenterAchievements.self,
	GameCenterMatchmaking.self,
	GameCenterPlayer.self,
	GameCenterFriend.self,
	LeaderboardPlayer.self,
])

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

No branches or pull requests

2 participants