Quantcast
Channel: Questions in topic: "dllnotfoundexception"
Viewing all articles
Browse latest Browse all 201

Native plugin DllNotFoundExeption in Unity 4 (works in 5)

$
0
0
Hi, I am trying to include a native C plugin for use in the Editor but cannot get it going in Unity 4 on Windows 8. I can compile it into a bundle and include it in the project in Unity 4 on Mac OS X. I can also compile it into a 64 bit shared dll and include it in Unity 5 on Windows. However, Unity 4 on Windows spits out a DllNotFoundException when I try to use either a 32 or 64 bit version of the shared dll. I have tried placing the dll in: 'Assets/', 'Assets/Editor', 'Assets/Plugins', 'Assets/Plugins/Editor', and 'Assets/Plugins/x86', all to no avail (always spits out 'DllNotFounddException: PLUGIN_NAME', except when in the x86 folder, which produces: 'DllNotFounddException: FULL/PATH/TO/x86/PLUGIN_NAME'). Since the code is c99, I can't compile using VisualStudio. Instead, I'm using MinGW (tried on Linux, MacOSX and Windows) by running: i686-w64-mingw32-gcc -m32 -mwindows -c --std=c99 -DBUILDING_EXAMPLE_DLL *.c *.h i686-w64-mingw32-gcc -m32 -mwindows -shared -o myplugin.dll *.o Has anybody encountered this before? Is there a reason that the plugin would work in Unity 5 but not Unity 4? Thanks in advance.. //======================= EDIT - adding more info: I'm using: Windows 8 64-bit - running in Bootcamp on a recent Macbook Pro 13 - latest MinGW Unity - 4.6.5f1. Also running the `file` command on the dlls in cygwin produces: - 32 bit: `"PE32 executable (DLL) (console) Intel 80386, for MS Windows"` - 64 bit: `"PE32+ executable (DLL) (console) x86-64, for MS Windows"` so it seems to me that the produced dlls are compiled for the correct OS and architecture. //======================= EDIT 2: I've successfully compiled a test plugin (containing a function that adds two numbers) using the same commands as above and was surprised to see it works from Unity 4 when I DllImport the absolute file path (as opposed to just the dll name). Unfortunately, Unity still doesn't find the actual plugin I'm interested in even when using the absolute file path. (Also, to preempt any such suggestions, switching the project to Unity 5 to get this going is not an option).

Viewing all articles
Browse latest Browse all 201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>