Skills

Gdextension

Use when building native extensions for Godot, godot-cpp (C++) or gdext (Rust)...

Install

npx skills add jame581/GodotPrompter --skill gdextension -g -a claude-code -y
Category
Engineering
Updated
3d ago
License
MIT
Context cost
Mediumabout 2,717 tokens
Runs scripts
No, instructions only

What it does

Use when building native extensions for Godot, godot-cpp (C++) or gdext (Rust), binding classes, building, and GDScript/C# interop

GDExtension

Run native C++ (or Rust) in Godot as a shared library without recompiling the engine. Use it for performance-critical code, wrapping existing C/C++ libraries, or language bindings.

Related skills: csharp-godot for when C# is enough, gdscript-advanced for GDScript performance idioms first, godot-optimization for profiling before going native, addon-development for distributing the result, export-pipeline for shipping the binaries.


1. When to reach for GDExtension

Reach for GDScript or C# for almost all game logic. Choose GDExtension only when you genuinely need it:

  • Native speed in a hot loop that GDScript/C# can't keep up with (profile first, see godot-optimization).
  • Wrapping a C/C++ library you must call directly.
  • Building a language binding.

Contrast with C++ modules, which are compiled into the engine and therefore require shipping a custom engine binary. GDExtension's key advantage is that it runs against a stock Godot, you distribute just a shared library. It is "more complicated to use than GDScript and C#," so don't reach for it by default.

⚠️ Changed in Godot 4.7: The engine's built-in text servers (text_server_adv, text_server_fb) can no longer be built as GDExtensions, their gdextension_build/ scripts were removed. Writing your own text server as a GDExtension by subclassing TextServerExtension is unaffected. See GH-117056.


2. Project & build setup

mkdir gdextension_example && cd gdextension_example
git init
# IMPORTANT: use the godot-cpp branch matching your target engine version (e.g. 4.3),
# not the literal "4.x".
git submodule add -b 4.3 https://github.com/godotengine/godot-cpp
cd godot-cpp && git submodule update --init && cd ..

Directory layout:

Read the whole SKILL.md on GitHub

More in Engineering