Please sign in to comment.
generate.io, OpenGL, Box, Image, Regex and Range on Windows/MinGW.
1. MINGW DLL EXPORT/IMPORT a) When functions in a DLL are not declared/defined as dllexport, all the functions are automatically exported by gcc (dll.a) b) Functions auto-exported by gcc are exported using thunks in the dll.a file (function pointers from C.dll will differ in two different A and B dlls both loading C. dll) c) When AT LEAST one function in the dll is declared/defined as dllexport, ONLY that/those function/s will be exported d) Functions exported with dllexport won't use a thunk in the dll.a file (function pointers from C.dll will be the same in two different A and B dlls both loading C. dll). 2. THE PROBLEM a) generate.io is not defining the Init function as dllexport for MinGW b) Box and Image addons are exporting some functions (ie: for the OpenGL addon to use them). Those addons are using dllexport/dllimport. c) So, loading Box and Image addons will fail ("Init function not found") due to 2.a + 2.b = 1.c To fix this situation (try 1): d) If we remove the dllexport/dllimport modifiers in Box and Image addons, all the functions will be exported, including their Init function (see 2.a and 1.a) e) Box and Image addons won't fail to load. f) But OpenGL addon will fail to load ("missing protos") due to 2.d and then 1.b. To fix this situation (try 2 OK): g) Don't remove the dllexport/dllimport modifiers from Box and Image addons h) Apply dllexport to the Init function in generate.io, so we will have 1.c and 1.d in ALL the addons. i) Now, addons won't fail to find their Init function (1.c) and won't have 2.f anymore (1.d) j) But now, due to 1.c, building Regex addon will fail because it depends on Range addon wich is not explicitly exporting functions. k) We have to create an IoRangeApi.h (ala Box e Image), then apply the IORANGE_API modifier to the functions being imported by Regex at least, and add a BUILDING_RANGE_ADDON definition to the Range CMakeLists.txt file. Now, OpenGL, Box, Image, Regex and Range will build and load correctly.
- Loading branch information...
Showing with 25 additions and 6 deletions.
|@@ -0,0 +1,15 @@|
|+#define IORANGE_API __declspec(dllexport)|
|+#define IORANGE_API __declspec(dllimport)|