Skip to content

Version check for <4.5 is now broken, due to relying on get_godot_version2 #1398

@Bromeon

Description

@Bromeon

#1394 introduced regression in the following scenario:

  • compile godot-rust with default features (API 4.5)
  • run in Godot 4.4

The error message now being:

ERROR: Attempt to get non-existent interface function: 'get_godot_version2'.
   at: get_interface_function (core/extension/gdextension.cpp:691)

thread '<unnamed>' (116156) panicked at godot-ffi/src/interface_init.rs:134:9:
null function pointer
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

instead of previously:

thread '<unnamed>' (122520) panicked at godot-ffi/src/interface_init.rs:104:9:
gdext was compiled against newer Godot version: v4.5.stable.official
but loaded by older Godot binary, with version: v4.4.1.stable.official

Update your Godot engine version, or compile gdext against an older version.
For more information, read https://godot-rust.github.io/book/toolchain/compatibility.html.

Using the new version is strictly worse because it works only in >= 4.5, while the old one works for all Godot versions.

The only scenario where the old one doesn't work is when compiling Godot with deprecated functions disabled, which isn't a build configuration we officially support. If it's easy to support, why not -- but not at the cost of degrading experience on stable 🙂


If we want to support both, we can do the following:

  • try to fetch get_godot_version
  • if unavailable, fetch get_godot_version2

Then use whichever function is available.

This does make some future things harder, like having non-null function pointers as fields of a Bindings struct, so I'm not fully sure what's the best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugc: ffiLow-level components and interaction with GDExtension API

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions