+2 votes

Am creating multiple GDNative modules, each module makes use of a different web API, but is taking me a lot of time by going back and forward between the projects of a single Visual Studio solution, confirming that the function names and arguments match, so in my Godot project the calls are the same regardless of the .dll loaded.

Using this example code:

#include "GDBase.h

using namespace godot;

extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) {

extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o) {

extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) {


#ifndef GD_BASE_H
#define GD_BASE_H

#include <Godot.hpp>
#include <Node.hpp>

namespace godot {

class GDBase : public Node {
    GODOT_CLASS(GDBase, Node)

    static void _register_methods();


    void _init(); // our initializer called by Godot

    virtual String get_api_name();




#include "GDBase.h"

using namespace godot;

void GDBase::_register_methods() {
    register_method("get_api_name", &GDBase:get_api_name);

GDBase::GDBase() {

GDBase::~GDBase() {
    // cleanup here

void GDBase::_init() {
    // initialize variables

String GDBase::get_api_name() {
       return "Base";

Lets say I want o inherit GDBase, to GDClassA and GDClassB, and override getapiname, I've tried:
inheritance of class GDBase to GDClassA but GODOT_CLASS(GDClassA, GDBase) isn't recognized as a Godot class; Interfaces with abstract class, but inheritance isn't allowed (according to Visual Studio)

What is the correct way to inherit GDBase, if is even possible.


in Engine by (29 points)

1 Answer

+2 votes
Best answer

As comments of GODOT_CLASS registration macro says, you should use Godot's (ultimate predecessor) class, Node in your case, not GDBase.

by (1,648 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.