Merge pull request #32607 from Calinou/doc-gdnative-singleton-prefix
Document the GDNative singleton method prefix being changeable
This commit is contained in:
commit
d514bdff62
3 changed files with 3 additions and 3 deletions
|
@ -39,7 +39,7 @@
|
||||||
[b]Note:[/b] If the library defines tool scripts that run inside the editor, [code]reloadable[/code] must be [code]false[/code]. Otherwise, the editor will attempt to unload the tool scripts while they're in use and crash.
|
[b]Note:[/b] If the library defines tool scripts that run inside the editor, [code]reloadable[/code] must be [code]false[/code]. Otherwise, the editor will attempt to unload the tool scripts while they're in use and crash.
|
||||||
</member>
|
</member>
|
||||||
<member name="singleton" type="bool" setter="set_singleton" getter="is_singleton" default="false">
|
<member name="singleton" type="bool" setter="set_singleton" getter="is_singleton" default="false">
|
||||||
If [code]true[/code], Godot loads the library at startup rather than the first time a script uses the library, calling [code]gdnative_singleton[/code] after initializing the library. The library remains loaded as long as Godot is running.
|
If [code]true[/code], Godot loads the library at startup rather than the first time a script uses the library, calling [code]{prefix}gdnative_singleton[/code] after initializing the library (where [code]{prefix}[/code] is the value of [member symbol_prefix]). The library remains loaded as long as Godot is running.
|
||||||
[b]Note:[/b] A singleton library cannot be [member reloadable].
|
[b]Note:[/b] A singleton library cannot be [member reloadable].
|
||||||
</member>
|
</member>
|
||||||
<member name="symbol_prefix" type="String" setter="set_symbol_prefix" getter="get_symbol_prefix" default=""godot_"">
|
<member name="symbol_prefix" type="String" setter="set_symbol_prefix" getter="get_symbol_prefix" default=""godot_"">
|
||||||
|
|
|
@ -339,7 +339,7 @@ bool GDNative::initialize() {
|
||||||
if (err || !library_init) {
|
if (err || !library_init) {
|
||||||
OS::get_singleton()->close_dynamic_library(native_handle);
|
OS::get_singleton()->close_dynamic_library(native_handle);
|
||||||
native_handle = NULL;
|
native_handle = NULL;
|
||||||
ERR_PRINT("Failed to obtain godot_gdnative_init symbol");
|
ERR_PRINTS("Failed to obtain " + library->get_symbol_prefix() + "gdnative_init symbol");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ void register_gdnative_types() {
|
||||||
proc_ptr);
|
proc_ptr);
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
ERR_PRINT((String("No godot_gdnative_singleton in \"" + singleton->get_library()->get_current_library_path()) + "\" found").utf8().get_data());
|
ERR_PRINTS("No " + lib->get_symbol_prefix() + "gdnative_singleton in \"" + singleton->get_library()->get_current_library_path() + "\" found");
|
||||||
} else {
|
} else {
|
||||||
singleton_gdnatives.push_back(singleton);
|
singleton_gdnatives.push_back(singleton);
|
||||||
((void (*)())proc_ptr)();
|
((void (*)())proc_ptr)();
|
||||||
|
|
Loading…
Reference in a new issue