Using Godot version 4.2.stable.official.46dc27791.
Using godot-cpp latest commit at d6e5286.
In this simple example, the _ready
function will never be called on InheritedTest
when the extension is compiled in Release x86_64 and is linking to libgodot-cpp.windows.template_release.x86_64.lib
. It works in Debug mode when linking to libgodot-cpp.windows.template_debug.x86_64.lib
.
I can verify that the function is never called (and not just optimized away) because it also happens in my real extension (below is a minimal reproduction).
class BaseTest : public Node
{
public:
GDCLASS(BaseTest, Node);
public:
static void _bind_methods()
{
}
};
class InheritedTest : public BaseTest
{
public:
GDCLASS(InheritedTest, BaseTest);
public:
static void _bind_methods()
{
}
void _ready()
{
OS::get_singleton()->alert(U"Never called");
}
};
GDREGISTER_CLASS(BaseTest);
GDREGISTER_CLASS(InheritedTest);
Add InheritedTest
to the main scene, build in Release and start Godot. InheritedTest::_ready
should be called, but it is not. Test in Debug, and it is called.
I have not been able to figure this out. Any ideas?