-
Notifications
You must be signed in to change notification settings - Fork 54
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
Extension dylibs aren't being unloaded on Hot Reload #384
Comments
In fact the extension can be as simple as @_cdecl("swift_entry_point") public func enterExtension (interface: OpaquePointer?, library: OpaquePointer?, extension: OpaquePointer?) -> UInt8 {
return 1
}
class SomeClass {} with no dependencies at all and the issue will still be reproducible. It just needs a little tweak in Godot's source code (godotengine/godot#87938), since Godot does not properly handle null in Looking into Godot's extension reload, The function dlclose() decrements the reference count on the dynamic library handle handle. If the reference count drops to zero and no other loaded libraries use symbols in it, then the dynamic library is unloaded. |
I do not think this is a Godot issue, but an interoperability issue between Swift and loading dynamic modules. I created a very simple sample (https://tirania.org/tmp/demo-swift-dlopen.tar.gz) that exhibits the same issue, here is the sample for the main program:
And then I replace |
And I can no longer reproduce the error. I am not sure what I did, but now I am able to load both libraries, and the warning is gone, and the libraries do show the right output. |
This was originally mentioned in #273
I made a simplistic entry point using
GDExtension
target as the only dependency:And configured gdextension as reloadable:
This was enough to reproduce the issue:
This will result in
The text was updated successfully, but these errors were encountered: