I'm using Unity 5 Pro and trying to get a simple DLL to work but keep getting a DllNotFoundException (both in the Unity editor and with an external x86 build). I've gone through the manual very carefully (plus all of the numerous posts from people with similar problems), and I think I'm doing everything I need to do (I've written plenty of DLLs in the past, so I think I know what I'm doing on that side of things). Here's the summary:
- Running on Windows 8.1
- DLL compiled with Visual Studio 2013, C++ only (no CLR), multi-byte character set, MT release target, X86 machine type.
- DLL contains a single stub function "int foo()" (within an extern "C" block)
- DLL placed in \Assets\Plugins\x86
- Unity imports the DLL OK (i.e. it appears in the Assets view)
- Unity plugin settings: Standalone, Windows, X86
- DLL called with the following code:
[DllImport("MyPlugin")]
private static extern int foo();
.
.
.
int n = foo();
It's hard to see how it get much simpler than that.
Has anyone managed to get a C++ DLL to actually work with Unity 5? I'm beginning to think that it just isn't possible (judging by the number of problem posts with DLLs). Or am I missing something fundamental?
Unfortunately, this is a show-stopper for me as I need to do quite a lot of heavy lifting with a business back-end, and this needs to be in C++.
↧