+1 vote

Hello,

I am trying to compile a module I have made in C++ and it works flawlessly when I do it as a static build.

When trying to compile it as a dynamic library, it fails entirely though; even with the simple example provided in the Godot documentation : Godot Custom C++ Modules.

It basically cannot resolve externals references when linking the library.

e.g.

sumator.windows.tools.32.obj : error LNK2019: unresolved external symbol "public: static void __cdecl ObjectTypeDB::get_property_list(class StringName,class List<struct PropertyInfo,class DefaultAllocator> *,bool,class Object const *)" (?get_property_list@ObjectTypeDB@@SAXVStringName@@PAV?$List@UPropertyInfo@@VDefaultAllocator@@@@_NPBVObject@@@Z) referenced in function "protected: virtual void __thiscall Reference::_get_property_listv(class List<struct PropertyInfo,class DefaultAllocator> *,bool)const " (?_get_property_listv@Reference@@MBEXPAV?$List@UPropertyInfo@@VDefaultAllocator@@@@_N@Z)

In total, it misses 46 unresolved externals. I tried with both MSVC15 and GCC 5.3 on Windows. (Haven't tried on Linux nor OSX)

Anybody does have a pointer how to quickly fix this ? Or does the tutorial only works in Linux ? (as it mentions *.so). If too nasty to fix, I suppose i'll have to wait until Godot3 is out. (Must admit I can't be more excited ! :p)

asked Jul 17, 2017 in Engine by MaximeG (41 points)

1 Answer

0 votes

I don't think you can dynamically link a module. The only thing you can do is create a statically linked module that dlopen() a library. That's the problem that GDNative will solve in Godot 3.0.

answered Jul 18, 2017 by vnen (763 points)

Well thank you for confirming. It was already looking a bit too magical in the documentation.

It should be amended in order to avoid inducing users in confusion. How can I propose my help for documentation ? (I'd like to help the Godot project in general :) )

I never realized the documentation shows a way to dynamically link the module. If you follow all the steps and it didn't work, might be a problem with the documentation itself (it seems to be focused on Linux only, indeed).

If so you can open an issue on https://github.com/godotengine/godot-docs

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 How to use this Q&A? before posting your first questions.