gilzoide / hello-gdextension

Samples and experiments using Godot 4 + GDExtension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example in C how to register class

the-ssd opened this issue · comments

commented

The best I was able to make is this

void register_class(const char* class_name, const char* parent_class_name){

    GDExtensionClassCreationInfo info;
    info.is_virtual = 0;
    info.is_abstract = 0;

    info.create_instance_func = create;
    info.free_instance_func = obj_free;

    StringName name = construct_StringName_from_cstring(class_name);
    StringName parent_name = construct_StringName_from_cstring(parent_class_name);

    interface->classdb_register_extension_class(library, &name, &parent_name, &info);

}

but it crashes

Hi!
Since this is not an issue with the example provided in this repo, I don't think the Issues tab is the right place for this, so I'm closing this one.
Please use the Discussions tab for this kind of discussion.