@@ -306,17 +306,17 @@ We'll start by creating an ``api.h`` file in the ``src`` folder:
306306
307307 // API methods.
308308
309- struct Constructors
309+ extern struct Constructors
310310 {
311311 GDExtensionInterfaceStringNameNewWithLatin1Chars string_name_new_with_latin1_chars;
312312 } constructors;
313313
314- struct Destructors
314+ extern struct Destructors
315315 {
316316 GDExtensionPtrDestructor string_name_destructor;
317317 } destructors;
318318
319- struct API
319+ extern struct API
320320 {
321321 GDExtensionInterfaceClassdbRegisterExtensionClass2 classdb_register_extension_class2;
322322 } api;
@@ -345,6 +345,10 @@ in the ``src`` folder, adding the following code:
345345
346346 GDExtensionClassLibraryPtr class_library = NULL;
347347
348+ struct Constructors constructors;
349+ struct Destructors destructors;
350+ struct API api;
351+
348352 void load_api(GDExtensionInterfaceGetProcAddress p_get_proc_address)
349353 {
350354 // Get helper functions first.
@@ -537,7 +541,7 @@ So let's change the ``api.h`` to include these new functions:
537541.. code-block :: c
538542
539543 ...
540- struct API
544+ extern struct API
541545 {
542546 GDExtensionInterfaceClassdbRegisterExtensionClass2 classdb_register_extension_class2;
543547 GDExtensionInterfaceClassdbConstructObject classdb_construct_object;
@@ -860,13 +864,13 @@ structs:
860864
861865.. code-block :: c
862866
863- struct Constructors {
867+ extern struct Constructors {
864868 ...
865869 GDExtensionVariantFromTypeConstructorFunc variant_from_float_constructor;
866870 GDExtensionTypeFromVariantConstructorFunc float_from_variant_constructor;
867871 } constructors;
868872
869- struct API
873+ extern struct API
870874 {
871875 ...
872876 GDExtensionInterfaceGetVariantFromTypeConstructor get_variant_from_type_constructor;
@@ -1004,19 +1008,19 @@ function for actually binding our custom method.
10041008
10051009.. code-block :: c
10061010
1007- struct Constructors
1011+ extern struct Constructors
10081012 {
10091013 ...
10101014 GDExtensionInterfaceStringNewWithUtf8Chars string_new_with_utf8_chars;
10111015 } constructors;
10121016
1013- struct Destructors
1017+ extern struct Destructors
10141018 {
10151019 ...
10161020 GDExtensionPtrDestructor string_destructor;
10171021 } destructors;
10181022
1019- struct API
1023+ extern struct API
10201024 {
10211025 ...
10221026 GDExtensionInterfaceClassdbRegisterExtensionClassMethod classdb_register_extension_class_method;
@@ -1326,7 +1330,7 @@ the ``api.h`` file:
13261330
13271331.. code-block :: c
13281332
1329- struct API {
1333+ extern struct API {
13301334 ...
13311335 GDExtensionInterfaceClassdbRegisterExtensionClassProperty classdb_register_extension_class_property;
13321336 } api;
@@ -1485,7 +1489,7 @@ We'll also add a new struct to this file, to hold function pointers for custom o
14851489
14861490.. code-block :: c
14871491
1488- struct Operators
1492+ extern struct Operators
14891493 {
14901494 GDExtensionPtrOperatorEvaluator string_name_equal;
14911495 } operators;
@@ -1494,6 +1498,8 @@ Then in the ``api.c`` file we'll load the function pointer from the API:
14941498
14951499.. code-block :: c
14961500
1501+ struct Operators operators;
1502+
14971503 void load_api(GDExtensionInterfaceGetProcAddress p_get_proc_address)
14981504 {
14991505 // Get helper functions first.
@@ -1652,20 +1658,20 @@ new one for holding engine methods to call.
16521658
16531659.. code-block :: c
16541660
1655- struct Constructors
1661+ extern struct Constructors
16561662 {
16571663 ...
16581664 GDExtensionPtrConstructor vector2_constructor_x_y;
16591665 } constructors;
16601666
16611667 ...
16621668
1663- struct Methods
1669+ extern struct Methods
16641670 {
16651671 GDExtensionMethodBindPtr node2d_set_position;
16661672 } methods;
16671673
1668- struct API
1674+ extern struct API
16691675 {
16701676 ...
16711677 GDExtensionInterfaceClassdbGetMethodBind classdb_get_method_bind;
@@ -1676,6 +1682,8 @@ Then in the ``api.c`` file we can grab the function pointers from Godot:
16761682
16771683.. code-block ::
16781684
1685+ struct Methods methods;
1686+
16791687 void load_api(GDExtensionInterfaceGetProcAddress p_get_proc_address)
16801688 {
16811689 // Get helper functions first.
@@ -1805,7 +1813,7 @@ register a signal, the other is a helper function to wrap the signal binding.
18051813
18061814.. code-block :: c
18071815
1808- struct API
1816+ extern struct API
18091817 {
18101818 ...
18111819 GDExtensionInterfaceClassdbRegisterExtensionClassSignal classdb_register_extension_class_signal;
@@ -1926,28 +1934,28 @@ helper function for the call:
19261934
19271935.. code-block :: c
19281936
1929- struct Constructors
1937+ extern struct Constructors
19301938 {
19311939 ...
19321940 GDExtensionVariantFromTypeConstructorFunc variant_from_string_name_constructor;
19331941 GDExtensionVariantFromTypeConstructorFunc variant_from_vector2_constructor;
19341942 } constructors;
19351943
1936- struct Destructors
1944+ extern struct Destructors
19371945 {
19381946 ..
19391947 GDExtensionInterfaceVariantDestroy variant_destroy;
19401948 } destructors;
19411949
19421950 ...
19431951
1944- struct Methods
1952+ extern struct Methods
19451953 {
19461954 ...
19471955 GDExtensionMethodBindPtr object_emit_signal;
19481956 } methods;
19491957
1950- struct API
1958+ extern struct API
19511959 {
19521960 ...
19531961 GDExtensionInterfaceObjectMethodBindCall object_method_bind_call;
0 commit comments