class_gdnativelibrary.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the GDNativeLibrary.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_GDNativeLibrary:
  6. GDNativeLibrary
  7. ===============
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. An external library containing functions or script classes to use in Godot.
  13. Properties
  14. ----------
  15. +-------------------------------------+--------------------------------------------------------------------+
  16. | :ref:`ConfigFile<class_ConfigFile>` | :ref:`config_file<class_GDNativeLibrary_property_config_file>` |
  17. +-------------------------------------+--------------------------------------------------------------------+
  18. | :ref:`bool<class_bool>` | :ref:`load_once<class_GDNativeLibrary_property_load_once>` |
  19. +-------------------------------------+--------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`reloadable<class_GDNativeLibrary_property_reloadable>` |
  21. +-------------------------------------+--------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`singleton<class_GDNativeLibrary_property_singleton>` |
  23. +-------------------------------------+--------------------------------------------------------------------+
  24. | :ref:`String<class_String>` | :ref:`symbol_prefix<class_GDNativeLibrary_property_symbol_prefix>` |
  25. +-------------------------------------+--------------------------------------------------------------------+
  26. Methods
  27. -------
  28. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------+
  29. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_current_dependencies<class_GDNativeLibrary_method_get_current_dependencies>` **(** **)** const |
  30. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_String>` | :ref:`get_current_library_path<class_GDNativeLibrary_method_get_current_library_path>` **(** **)** const |
  32. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------+
  33. Description
  34. -----------
  35. 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.
  36. Tutorials
  37. ---------
  38. - :doc:`../tutorials/plugins/gdnative/gdnative-c-example`
  39. - :doc:`../tutorials/plugins/gdnative/gdnative-cpp-example`
  40. Property Descriptions
  41. ---------------------
  42. .. _class_GDNativeLibrary_property_config_file:
  43. - :ref:`ConfigFile<class_ConfigFile>` **config_file**
  44. +----------+------------------------+
  45. | *Setter* | set_config_file(value) |
  46. +----------+------------------------+
  47. | *Getter* | get_config_file() |
  48. +----------+------------------------+
  49. This resource in INI-style :ref:`ConfigFile<class_ConfigFile>` format, as in ``.gdnlib`` files.
  50. ----
  51. .. _class_GDNativeLibrary_property_load_once:
  52. - :ref:`bool<class_bool>` **load_once**
  53. +----------+----------------------+
  54. | *Setter* | set_load_once(value) |
  55. +----------+----------------------+
  56. | *Getter* | should_load_once() |
  57. +----------+----------------------+
  58. 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.
  59. If ``false``, Godot loads a separate copy of the library into memory for each script that references it.
  60. ----
  61. .. _class_GDNativeLibrary_property_reloadable:
  62. - :ref:`bool<class_bool>` **reloadable**
  63. +----------+-----------------------+
  64. | *Setter* | set_reloadable(value) |
  65. +----------+-----------------------+
  66. | *Getter* | is_reloadable() |
  67. +----------+-----------------------+
  68. 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.
  69. **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.
  70. ----
  71. .. _class_GDNativeLibrary_property_singleton:
  72. - :ref:`bool<class_bool>` **singleton**
  73. +----------+----------------------+
  74. | *Setter* | set_singleton(value) |
  75. +----------+----------------------+
  76. | *Getter* | is_singleton() |
  77. +----------+----------------------+
  78. If ``true``, Godot loads the library at startup rather than the first time a script uses the library, calling ``gdnative_singleton`` after initializing the library. The library remains loaded as long as Godot is running.
  79. **Note:** A singleton library cannot be :ref:`reloadable<class_GDNativeLibrary_property_reloadable>`.
  80. ----
  81. .. _class_GDNativeLibrary_property_symbol_prefix:
  82. - :ref:`String<class_String>` **symbol_prefix**
  83. +----------+--------------------------+
  84. | *Setter* | set_symbol_prefix(value) |
  85. +----------+--------------------------+
  86. | *Getter* | get_symbol_prefix() |
  87. +----------+--------------------------+
  88. 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.
  89. On platforms that require statically linking libraries (currently only iOS), each library must have a different ``symbol_prefix``.
  90. Method Descriptions
  91. -------------------
  92. .. _class_GDNativeLibrary_method_get_current_dependencies:
  93. - :ref:`PoolStringArray<class_PoolStringArray>` **get_current_dependencies** **(** **)** const
  94. Returns paths to all dependency libraries for the current platform and architecture.
  95. ----
  96. .. _class_GDNativeLibrary_method_get_current_library_path:
  97. - :ref:`String<class_String>` **get_current_library_path** **(** **)** const
  98. Returns the path to the dynamic library file for the current platform and architecture.