-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Description
Following the GDExtension C example leads to compilation errors with scons
due to multiple definition warnings.
These errors are specific to the api
, constructors
and destructors
variables defined in api.h which break the one definition rule by defining variables inside a header file:
godot-docs/tutorials/scripting/gdextension/gdextension_c_example.rst
Lines 291 to 324 in e4d463e
.. code-block:: c | |
#pragma once | |
/* | |
This file works as a collection of helpers to call the GDExtension API | |
in a less verbose way, as well as a cache for methods from the discovery API, | |
just so we don't have to keep loading the same methods again. | |
*/ | |
#include "gdextension_interface.h" | |
#include "defs.h" | |
extern GDExtensionClassLibraryPtr class_library; | |
// API methods. | |
struct Constructors | |
{ | |
GDExtensionInterfaceStringNameNewWithLatin1Chars string_name_new_with_latin1_chars; | |
} constructors; | |
struct Destructors | |
{ | |
GDExtensionPtrDestructor string_name_destructor; | |
} destructors; | |
struct API | |
{ | |
GDExtensionInterfaceClassdbRegisterExtensionClass2 classdb_register_extension_class2; | |
} api; | |
void load_api(GDExtensionInterfaceGetProcAddress p_get_proc_address); |
My suspicion is that these variables should be static
, however I cannot confirm that because I have not managed to compile a working extension.
Metadata
Metadata
Assignees
Labels
No labels