class_gdnativelibrary.rst 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/gdnative/doc_classes/GDNativeLibrary.xml.
  6. .. _class_GDNativeLibrary:
  7. GDNativeLibrary
  8. ===============
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. An external library containing functions or script classes to use in Godot.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A GDNative library can implement :ref:`NativeScript<class_NativeScript>`\ s, global functions to call with the :ref:`GDNative<class_GDNative>` class, or low-level engine extensions through interfaces such as :ref:`ARVRInterfaceGDNative<class_ARVRInterfaceGDNative>`. The library must be compiled for each platform and architecture that the project will run on.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`../tutorials/scripting/gdnative/gdnative_c_example`
  19. - :doc:`../tutorials/scripting/gdnative/gdnative_cpp_example`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-------------------------------------+--------------------------------------------------------------------+--------------+
  26. | :ref:`ConfigFile<class_ConfigFile>` | :ref:`config_file<class_GDNativeLibrary_property_config_file>` | |
  27. +-------------------------------------+--------------------------------------------------------------------+--------------+
  28. | :ref:`bool<class_bool>` | :ref:`load_once<class_GDNativeLibrary_property_load_once>` | ``true`` |
  29. +-------------------------------------+--------------------------------------------------------------------+--------------+
  30. | :ref:`bool<class_bool>` | :ref:`reloadable<class_GDNativeLibrary_property_reloadable>` | ``true`` |
  31. +-------------------------------------+--------------------------------------------------------------------+--------------+
  32. | :ref:`bool<class_bool>` | :ref:`singleton<class_GDNativeLibrary_property_singleton>` | ``false`` |
  33. +-------------------------------------+--------------------------------------------------------------------+--------------+
  34. | :ref:`String<class_String>` | :ref:`symbol_prefix<class_GDNativeLibrary_property_symbol_prefix>` | ``"godot_"`` |
  35. +-------------------------------------+--------------------------------------------------------------------+--------------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------+
  42. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_current_dependencies<class_GDNativeLibrary_method_get_current_dependencies>` **(** **)** |const| |
  43. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------+
  44. | :ref:`String<class_String>` | :ref:`get_current_library_path<class_GDNativeLibrary_method_get_current_library_path>` **(** **)** |const| |
  45. +-----------------------------------------------+------------------------------------------------------------------------------------------------------------+
  46. .. rst-class:: classref-section-separator
  47. ----
  48. .. rst-class:: classref-descriptions-group
  49. Property Descriptions
  50. ---------------------
  51. .. _class_GDNativeLibrary_property_config_file:
  52. .. rst-class:: classref-property
  53. :ref:`ConfigFile<class_ConfigFile>` **config_file**
  54. .. rst-class:: classref-property-setget
  55. - void **set_config_file** **(** :ref:`ConfigFile<class_ConfigFile>` value **)**
  56. - :ref:`ConfigFile<class_ConfigFile>` **get_config_file** **(** **)**
  57. This resource in INI-style :ref:`ConfigFile<class_ConfigFile>` format, as in ``.gdnlib`` files.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _class_GDNativeLibrary_property_load_once:
  61. .. rst-class:: classref-property
  62. :ref:`bool<class_bool>` **load_once** = ``true``
  63. .. rst-class:: classref-property-setget
  64. - void **set_load_once** **(** :ref:`bool<class_bool>` value **)**
  65. - :ref:`bool<class_bool>` **should_load_once** **(** **)**
  66. If ``true``, Godot loads only one copy of the library and each script that references the library will share static data like static or global variables.
  67. If ``false``, Godot loads a separate copy of the library into memory for each script that references it.
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_GDNativeLibrary_property_reloadable:
  71. .. rst-class:: classref-property
  72. :ref:`bool<class_bool>` **reloadable** = ``true``
  73. .. rst-class:: classref-property-setget
  74. - void **set_reloadable** **(** :ref:`bool<class_bool>` value **)**
  75. - :ref:`bool<class_bool>` **is_reloadable** **(** **)**
  76. If ``true``, the editor will temporarily unload the library whenever the user switches away from the editor window, allowing the user to recompile the library without restarting Godot.
  77. \ **Note:** If the library defines tool scripts that run inside the editor, ``reloadable`` must be ``false``. Otherwise, the editor will attempt to unload the tool scripts while they're in use and crash.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_GDNativeLibrary_property_singleton:
  81. .. rst-class:: classref-property
  82. :ref:`bool<class_bool>` **singleton** = ``false``
  83. .. rst-class:: classref-property-setget
  84. - void **set_singleton** **(** :ref:`bool<class_bool>` value **)**
  85. - :ref:`bool<class_bool>` **is_singleton** **(** **)**
  86. If ``true``, Godot loads the library at startup rather than the first time a script uses the library, calling ``{prefix}gdnative_singleton`` after initializing the library (where ``{prefix}`` is the value of :ref:`symbol_prefix<class_GDNativeLibrary_property_symbol_prefix>`). The library remains loaded as long as Godot is running.
  87. \ **Note:** A singleton library cannot be :ref:`reloadable<class_GDNativeLibrary_property_reloadable>`.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_GDNativeLibrary_property_symbol_prefix:
  91. .. rst-class:: classref-property
  92. :ref:`String<class_String>` **symbol_prefix** = ``"godot_"``
  93. .. rst-class:: classref-property-setget
  94. - void **set_symbol_prefix** **(** :ref:`String<class_String>` value **)**
  95. - :ref:`String<class_String>` **get_symbol_prefix** **(** **)**
  96. The prefix this library's entry point functions begin with. For example, a GDNativeLibrary would declare its ``gdnative_init`` function as ``godot_gdnative_init`` by default.
  97. On platforms that require statically linking libraries (currently only iOS), each library must have a different ``symbol_prefix``.
  98. .. rst-class:: classref-section-separator
  99. ----
  100. .. rst-class:: classref-descriptions-group
  101. Method Descriptions
  102. -------------------
  103. .. _class_GDNativeLibrary_method_get_current_dependencies:
  104. .. rst-class:: classref-method
  105. :ref:`PoolStringArray<class_PoolStringArray>` **get_current_dependencies** **(** **)** |const|
  106. Returns paths to all dependency libraries for the current platform and architecture.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_GDNativeLibrary_method_get_current_library_path:
  110. .. rst-class:: classref-method
  111. :ref:`String<class_String>` **get_current_library_path** **(** **)** |const|
  112. Returns the path to the dynamic library file for the current platform and architecture.
  113. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  114. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  115. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  116. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`