summaryrefslogtreecommitdiffstats
path: root/modules/gdnative/gdnative.cpp
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2017-09-17 20:59:46 +0200
committerGitHub <noreply@github.com>2017-09-17 20:59:46 +0200
commit259778ce8c861cc6f9e3ffa528cdabc06f2dfa39 (patch)
tree8147dc5d63ae943e03d9e17f62457058bc582abc /modules/gdnative/gdnative.cpp
parent574a5714dcbf5fcf126f3f99caab62a345e665c1 (diff)
parent8d57a3f3d5e6785d516f7709f6f666a603ef557e (diff)
downloadredot-engine-259778ce8c861cc6f9e3ffa528cdabc06f2dfa39.tar.gz
Merge pull request #11296 from touilleMan/gdnative-api-struct
[GDnative] pass api as struct of function pointers to loaded gdnative modules
Diffstat (limited to 'modules/gdnative/gdnative.cpp')
-rw-r--r--modules/gdnative/gdnative.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 6da538844a..8cc8b0bec8 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -40,6 +40,16 @@
const String init_symbol = "godot_gdnative_init";
const String terminate_symbol = "godot_gdnative_terminate";
+#define GDAPI_FUNC(name, ret_type, ...) .name = name,
+#define GDAPI_FUNC_VOID(name, ...) .name = name,
+
+const godot_gdnative_api_struct api_struct = {
+ GODOT_GDNATIVE_API_FUNCTIONS
+};
+
+#undef GDAPI_FUNC
+#undef GDAPI_FUNC_VOID
+
String GDNativeLibrary::platform_names[NUM_PLATFORMS + 1] = {
"X11_32bit",
"X11_64bit",
@@ -91,7 +101,7 @@ GDNativeLibrary::Platform GDNativeLibrary::current_platform =
#endif
GDNativeLibrary::GDNativeLibrary()
- : library_paths() {
+ : library_paths(), singleton_gdnative(false) {
}
GDNativeLibrary::~GDNativeLibrary() {
@@ -249,6 +259,7 @@ bool GDNative::initialize() {
godot_gdnative_init_options options;
+ options.api_struct = &api_struct;
options.in_editor = Engine::get_singleton()->is_editor_hint();
options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);