godotengine / godotengine/godot-docs

Custom Modules in C++: Mention that building a dynamic library on windows is impossible (?)

Open
#5,143 3 comments 0 reactions 0 assignees View on GitHub
area:engine details enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
3.3.2-stable

**Issue description:**
I'm not sure if I'm correct on this, but I figured it's more of a documentation issue than a code issue.

After fixing up all the scons instructions to build a DLL out of the summator example, Godot crashes upon registering the types inside `register_summator_types()`. I traced this down to the fact that the Godot process and the DLL on windows do not share static and global variables, which cause `StringName` to be uninitalized in the DLL but not in the Godot process. The fix I found through research was to use a pair of `__declspec(dllexport)` and `__declspec(dllimport)` statements, however that would mean that Godot would need to export all static variables, so the DLL can import it or vice versa. I'm not too familiar with the inner workings of Godot, but my guess is that this would be a huge change to the codebase. Thus I propose to call it impossible to do on windows and document that in the docs.

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/development/cpp/custom_modules_in_cpp.html#improving-the-build-system-for-development

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.