I have some problems adding/using third party libraries.
What i am trying to do :
Using “MySql Connector C++” library in UE4 as a plugin to use MySql databases in my projects (MySQL :: MySQL Connector/C++ 8.0 Developer Guide).
First attempt using static libs :
I first tried to include the static Connector library in a plugin which is using boost library, that’s where the first problem appeared.
Boost library is using some preprocessor definitions like #define GNUC which doesn’t exist because UE is not using preprocessor macro (i can’t find the link where i read that sorry), i’m not sure what it means or implies exactly and i didn’t manage to find any workaround for that problem.
Second attempt using Dll :
Then i tried using my own Dll to avoid the compilation by the engine of the macros (maybe it’s a mistake because i dont understand fully these mechanics).
So i **first **tried to load my own dll copying the example given by the engine when creating a third library plugin, it’s working the dll is loaded and i can use the functions.
Then for my **second **try i added a function to my Dll using the Connector/boost libraries (i’m using them as static libraries to create my dll maybe it’s where i’m wrong) then when i try to load the Dll (GetHandleDll) it doesn’t work saying in the output :
‘UE4Editor.exe’ (Win32) : Loaded ‘F:\Projects\DllUETest\Plugins\TPDllTest\Binaries\ThirdParty\TPDllTestLibrary\Win64\TestDllConnector.dll’. Symbols loaded.
‘UE4Editor.exe’ (Win32) : Unloaded ‘F:\Projects\DllUETest\Plugins\TPDllTest\Binaries\ThirdParty\TPDllTestLibrary\Win64\TestDllConnector.dll’
[2019.11.12-18.54.22:696] 0]LogWindows: Failed to load ‘…/…/…/…/…/…/Projects/DllUETest/Plugins/TPDllTest/Binaries/ThirdParty/TPDllTestLibrary/Win64/TestDllConnector.dll’ (GetLastError=126)
The paths/loactions are good since i just replaced the new Dll from the first attempt and the “GetLastError=126” means that the module wasn’t found (from https://docs.microsoft.com/fr-fr/win…-codes–0-499-).
I also found that this loading/unloading could come from the response of the Dllmain of my Dll but i’m not using any main in either attempt (https://docs.microsoft.com/en-us/win…i-loadlibraryw)
Third attempt :
I tried two plugins using MySql which are working but i can’t access the sources. One author told me how he did it with some other lib but i would like to make the C++ lib work so i can modify and make my tools directly.
1- Is there something i didn’t try?
2- Did i do something wrong somewhere in my attempts (a workaround for the preprocessor problems or a mistake in my Dll setup?)
Thanks for reading, i didn’t link any code because i don’t know what can be relevant.
Sorry if it’s not the right section for this topic.