Make sure to call FPlatformProcess::FreeDllHandle(DLLHandle) to release the DLL in the function ShutdownModuleģ In your project put the. You can use IPluginManager::Get().FindPlugin(“PluginName”)->GetBaseDir() to help in getting the pathĪs soon as you call * DLLHandle = FPlatformProcess::GetDllHandle( Path) the engine will load your dll from your desired location Where path indicates absolute location of our DLL file. You’ll find a function named StartupModule which is called when module is loaded by the engineĪll you have to do is load our DLL from the folder using * DLLHandle = FPlatformProcess::GetDllHandle( Path) We will load that DLL manually from the correct path as soon as the plugin module is loaded by the engineĢ In your plugin’s main cpp file (like for a plugin named ABCD you’ll have a ABCD.cpp) Now since our DLL is in one of the folders in our plugin (you can use any folder, I used third party for consistency) Since our DLL is third party custom lib and cannot be found among standard windows dlls The line PublicDelayLoadDLLs avoids the engine from trying to load it immediately on startup, as engine would by default look in standard windows locations to search our DLL (Which it obviously wont find) lib file is located respective to the build.cs file of the module, so in this example FreeImageDirectory = “…//…//ThirdParty//FreeImage” Here the FreeImageDirectory is a string pointing to the location of the folder where. PublicAdditionalLibraries.Add(Path.Combine(FreeImageDirectory, "FreeImage.lib")) In your plugin’s build.cs add the following lines: PublicDelayLoadDLLs.Add("FreeImage.dll") lib file or import library which contains address of the header file functions in the DLLįor this example my library was called free image, you can find it hereġ. h header file that declares all the functions of the DLL that you can callģ.The. So a DLL with import library will come with three files minimum:Ģ.The. Its mostly straightforward but lack of docs made me confused. Import library avoids the mess that happens with function pointers instead you can call functions directly using a header Ok so to return the help I got from various sources of the community I’ll list the procedure for linking a third party dll with import library for a UE4 plugin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |