Publish Unity app with .dll plugin

I am using the Unity Pro 2.6 version, and I am trying to incorporate an external dll into the software via:

[DllImport (“myDllName”)] private static extern void myDllFunct();

So far I have got it to work on the development box both in the unity editor and a built Windows Standalone. However when I take the Windows Standalone to a different computer the dll functions do not work. In fact the dll functions seem to crash any function they are put in. The unity app runs fine, but it is not able to talk to the dll.

Here is an example of what is happening:

// txBoxData is a class string that is rendered in a GUI.TextField.

[DllImport (“myDllName”)] private static extern void myDllFunct();

void Update(){
txBoxData = “debug1_”;
myDllFunct();
txBoxData += “debug2_”;
}

On the development box, the GUI.TextField shows “debug1_debug2_”, but on the test box the GUI.TextField shows “debug1_”.

Thanks for any help you can provide

I found the solution to this thanks to Ben 12’s suggestion. The default project settings for Visual Studio 2005 include the requirement for a msvcr80.dll file. Since the test box did not have that file the dll I created for the Unity build would not work (or give me the proper error message).

The way I fixed this was by changing the project setting C+±>Code Generation->Runtime Library from “Multi-threaded DLL (/MD)” to Multi-threaded(/MT)” This significantly increased the size of the output dll, but I think it now lacks the dependency issues of the previous version.

May be a dumb question but did you put the DLL’s on the different computer? Do they depend on other DLL’s which might need to also be installed there? Are you sure they are in the correct folder?

Make sure that you don’t have any missing dependencies for the DLL. In particular, if you built the DLL in Visual C++ in Release mode, you need the corresponding version of the Visual C++ runtime installed on the other computer. If you built it in Debug mode, you need the same version of Visual C++ itself installed.