summaryrefslogtreecommitdiff
path: root/modules/gdnative
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative')
-rw-r--r--modules/gdnative/gdnative.cpp10
-rw-r--r--modules/gdnative/gdnative.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 158f7fd94d..07dba921b1 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -155,7 +155,6 @@ String GDNativeLibrary::get_active_library_path() const {
}
GDNative::GDNative() {
- initialized = false;
native_handle = NULL;
}
@@ -219,6 +218,9 @@ bool GDNative::initialize() {
library_init);
if (err || !library_init) {
+ OS::get_singleton()->close_dynamic_library(native_handle);
+ native_handle = NULL;
+ ERR_PRINT("Failed to obtain godot_gdnative_init symbol");
return false;
}
@@ -272,7 +274,11 @@ bool GDNative::terminate() {
OS::get_singleton()->close_dynamic_library(native_handle);
native_handle = NULL;
- return false;
+ return true;
+}
+
+bool GDNative::is_initialized() {
+ return (native_handle != NULL);
}
void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, native_call_cb p_callback) {
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index f02741f4e3..b03866f432 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -117,7 +117,6 @@ class GDNative : public Reference {
GDCLASS(GDNative, Reference)
Ref<GDNativeLibrary> library;
- bool initialized;
// TODO(karroffel): different platforms? WASM????
void *native_handle;