gdext.internal.ffi.types
Members list
Type members
Classlikes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
GDExtensionCallError.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Types
Only call_func and token are strictly required, however, object_id should be passed if its not a static method.
Only call_func and token are strictly required, however, object_id should be passed if its not a static method.
token should point to an address that uniquely identifies the GDExtension (for example, the GDExtensionClassLibraryPtr passed to the entry symbol function.
hash_func, equal_func, and less_than_func are optional. If not provided both call_func and callable_userdata together are used as the identity of the callable for hashing and comparison purposes.
The hash returned by hash_func is cached, hash_func will not be called more than once per callable.
is_valid_func is necessary if the validity of the callable can change before destruction.
free_func is necessary if callable_userdata needs to be cleaned up when the callable is freed.
Attributes
Only call_func and token are strictly required, however, object_id should be passed if its not a static method.
Only call_func and token are strictly required, however, object_id should be passed if its not a static method.
token should point to an address that uniquely identifies the GDExtension (for example, the GDExtensionClassLibraryPtr passed to the entry symbol function.
hash_func, equal_func, and less_than_func are optional. If not provided both call_func and callable_userdata together are used as the identity of the callable for hashing and comparison purposes.
The hash returned by hash_func is cached, hash_func will not be called more than once per callable.
is_valid_func is necessary if the validity of the callable can change before destruction.
free_func is necessary if callable_userdata needs to be cleaned up when the callable is freed.
Attributes
Attributes
Attributes
Attributes
Attributes
Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension.
Passed a pointer to a PackedStringArray that should be filled with the classes that may be used by the GDExtension.
Attributes
Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction, and export it so that it can be loaded via dlopen() or equivalent for the given platform.
Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction, and export it so that it can be loaded via dlopen() or equivalent for the given platform.
For example:
GDExtensionBool my_extension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization);
This function's name must be specified as the 'entry_symbol' in the .gdextension file.
This makes it the entry point of the GDExtension and will be called on initialization.
The GDExtension can then modify the r_initialization structure, setting the minimum initialization level, and providing pointers to functions that will be called at various stages of initialization/shutdown.
The rest of the GDExtension's interface to Godot consists of function pointers that can be loaded by calling p_get_proc_address("...") with the name of the function.
For example:
GDExtensionInterfaceGetGodotVersion get_godot_version = (GDExtensionInterfaceGetGodotVersion)p_get_proc_address("get_godot_version");
(Note that snippet may cause "cast between incompatible function types" on some compilers, you can silence this by adding an intermediary void* cast.)
You can then call it like a normal function:
GDExtensionGodotVersion godot_version; get_godot_version(&godot_version); printf("Godot v%d.%d.%d\n", godot_version.major, godot_version.minor, godot_version.patch);
All of these interface functions are described below, together with the name that's used to load it, and the function pointer typedef that shows its signature.
Attributes
Called for every frame iteration of the main loop.
Called for every frame iteration of the main loop.
Attributes
Called when shutting down the main loop.
Called when shutting down the main loop.
Attributes
Called when starting the main loop.
Called when starting the main loop.
Attributes
Pointer to custom ScriptInstance native implementation.
Pointer to custom ScriptInstance native implementation.
Attributes
Attributes
Attributes
Attributes
Attributes
Attributes
Pointer to ScriptInstance.
Pointer to ScriptInstance.
Attributes
In this API there are multiple functions which expect the caller to pass a pointer on return value as parameter. In order to make it clear if the caller should initialize the return value or not we have two flavor of types:
In this API there are multiple functions which expect the caller to pass a pointer on return value as parameter. In order to make it clear if the caller should initialize the return value or not we have two flavor of types:
GDExtensionXXXPtrfor pointer on an initialized valueGDExtensionUninitializedXXXPtrfor pointer on uninitialized value
Notes:
- Not respecting those requirements can seems harmless, but will lead to unexpected segfault or memory leak (for instance with a specific compiler/OS, or when two native extensions start doing ptrcall on each other).
- Initialization must be done with the function pointer returned by
variant_get_ptr_constructor, zero-initializing the variable should not be considered a valid initialization method here ! - Some types have no destructor (see
extension_api.json'shas_destructorfield), for them it is always safe to skip the constructor for the return value if you are in a hurry ;-)