diff options
author | Thomas Herzog <thomas.herzog@mail.com> | 2017-09-17 20:59:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-17 20:59:46 +0200 |
commit | 259778ce8c861cc6f9e3ffa528cdabc06f2dfa39 (patch) | |
tree | 8147dc5d63ae943e03d9e17f62457058bc582abc /modules/gdnative/gdnative.cpp | |
parent | 574a5714dcbf5fcf126f3f99caab62a345e665c1 (diff) | |
parent | 8d57a3f3d5e6785d516f7709f6f666a603ef557e (diff) | |
download | redot-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.cpp | 13 |
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); |