Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

GDExtension 是什么?

GDExtension 是 Godot 专属的一项技术,它允许引擎在运行时与本地的 shared libraries 进行交互。你可以利用它来运行原生代码,而无需将这些代码与引擎一起编译。

实现这一目标主要有三种方式:

  • gdextension_interface.h:一组 C 函数接口,用于实现 Godot 与 GDExtension 之间的双向通信。

  • extension_api.json:一份从 Godot API(核心功能)中暴露的 C 函数列表。

  • *.gdextension:一种由 Godot 引擎读取并用于加载 GDExtension 模块的配置文件格式。

多数开发者会使用现有的语言绑定来创建 GDExtension,例如 godot-cpp (for C++),或者 community-made ones

版本兼容性

参见适用于所有 GDExtension 的 godot-cpp Version Compatibility