0 votes

Hello,

I have gone through the summator example in the Development tutorials here: http://docs.godotengine.org/en/3.0/development/cpp/custom_modules_in_cpp.html. I can compile and use the summator module, however I want to set it up so that the module is created as a shared library, so I don't need to compile the whole engine each time I make changes.

The tutorial for setting this up assumes you are using the GNU compiler, with the command line argument -fPIC. Since I am trying to compile for Windows, the Visual Studio C++ compiler, cl, is used instead, which doesn't have -fPIC.

I was wondering if anybody knew what changes should be made to the SCsub file so that summator can be made as a shared module using the Visual Studio C++ compiler?

Many Thanks

asked Jan 28, 2019 in Engine by Nick74044 (21 points)

If at all possible save yourself some headache and use a statically linked lib instead. I remember trying to get dynamic modules to work on windows and at some point I gave up. I don't remember the showstopper, but if you need to get results fast, a static lib is simply easier. The time to compile godot is really low after the initial build.

Okay, sounds like a good idea. I haven't created static libraries before though. Do you know this would be done for a Godot module? Would it just involve changing the SCsub file and ensuring that the program can find the library?

Thanks for the help

Just follow the Summator tutorial up until "Improving the build system for development". Up until there the module is linked statically. After that just build godot using e.g. scons p=windows target=release_debug -j8. Note the -j8 which makes scons use up to 8 threads. If you leave that out it will only use one thread and building will take forever :).

Please log in or register to answer this question.

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.