Index of every page on this site: llms.txt
All skills
jame581 avatar

/gdextension

@426e8ab
by Jan Mesarčjame581/godotprompter979 stars
63
Run it yourself

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

Use this Skill: https://skilld.dev/gh/jame581/godotprompter/gdextension

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesrust-gdext.md

≈500 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Rust alternative — godot-rust / gdext

Community, not official. godot-rust/gdext is a community-maintained Rust binding (MPL-2.0). Maintained releases require Godot 4.2+ (4.1 support is frozen). The official native binding is godot-cpp (C++) — see the parent GDExtension skill.

Cargo.toml

A gdext extension is a cdylib crate that depends on the godot crate:

[lib]
crate-type = ["cdylib"]

[dependencies]
godot = "0.x.y"

Library entry point

Instead of the C++ extern "C" init function, gdext uses the #[gdextension] attribute on an ExtensionLibrary impl:

use godot::prelude::*;

struct MyExtension;

#[gdextension]
unsafe impl ExtensionLibrary for MyExtension {}

Declaring a class

#[derive(GodotClass)] registers the type; #[class(init, base=...)] picks the base class and auto-generates a constructor. #[init(val = ...)] gives a field a default:

#[derive(GodotClass)]
#[class(init, base=Sprite2D)]
struct Player {
    base: Base<Sprite2D>,
    #[init(val = 100)]
    hitpoints: i32,
}

Methods, virtuals, and signals

Implement the engine virtual trait (ISprite2D, etc.) for lifecycle callbacks, and a plain impl block for your own API. #[func] exposes a method to Godot; #[signal] declares a signal:

#[godot_api]
impl ISprite2D for Player {
    fn ready(&mut self) {
        godot_print!("Player ready!");
    }
}

#[godot_api]
impl Player {
    #[func]
    fn take_damage(&mut self, damage: i32) {
        // ...
    }

    #[signal]
    fn got_message();
}

The .gdextension file

The configuration is the same as the C++ case except the entry symbol — gdext exports a fixed symbol:

[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = "4.2"

Since Godot 4.2, gdext extensions load on any Godot where the runtime version is greater than or equal to the API version they were built against.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts29d3 checks · Risk SAFE
  • Gen Agent Trust Hub29d

    No security issues detected. The skill provides standard documentation and build instructions for Godot GDExtensions using official and well-known community resources.

  • Socket29d

    No alerts

  • Snyk29d

    Risk: LOW · No issues

Signed by skilld at 426e8ab. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated last month

README badge

README badge for jame581/godotprompter/gdextension