The Setup
I have 3. party libraries, which i am using as Native Plugins in Unity:
- dll’s for windows (x86 only)
- .so’s and .a’s for android
- .so’s and .a’s for linux
I have placed these files in folder:
- dlls for windows = Plugins → x86
- .so and .a for anroid = Plugins → libs → armeabi-v7a
- .so and .a for linux = Plugins → x86 (Same place as windows .dll’s)
I am using P-Invoke to call these plugins, and at first glance this seems to work, I can build to the different platforms and Unity makes sure to copy all the necessary files to the specific platform.
The Problem
The 3. party libraries have some base libraries, when the 3. party libraries tries to use these base libraries it throws the DllNotFoundException. Even through the libraries is in the Plugins folder, and the correct files have been copied doing the build.
Workarounds
I have found this and this workaround which works on Windows, but I have not been able to get it to work on Android or Linux.
The workaround on windows (developer machine) I am using is, I manually copies the needed base libraries(.dll’s) next to the .exe.
Thoughts
I see a few different possibilities on how to fix this:
- manually load the base libraries before using the normal 3. party libraries (how?).
- make sure the base libraries is placed correctly on the different platforms like the workaround on windows (where should they be placed?)
Does anyone know a solution to this problem?