|
From: Katherine R. <ill...@gm...> - 2014-12-19 18:27:39
|
Hello all,
My goal is to get a toy C++ library wrapped using SWIG, and accessible
to C# / Mono scripts in Unity (the game engine) on Windows.
Following a few SWIG- and Unity-specific tutorials I have generated
two DLLs in Visual Studio 2013 and added them to the Unity project.
But accessing the toy method at runtime is failing as follows...
DllNotFoundException: example
CSharpExampleLib.examplePINVOKE+SWIGExceptionHelper..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the
type initializer for SWIGExceptionHelper
CSharpExampleLib.examplePINVOKE..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the
type initializer for CSharpExampleLib.examplePINVOKE
CSharpExampleLib.example.fact (Int32 n)
SimpleController.Start () (at Assets/scripts/SimpleController.cs:10)
One atypical thing I needed to do was add the following library
references and namespace to the autogenerated C# wrapper files:
using System;
using System.Runtime.InteropServices;
namespace NameOfWindowsDll {
...
}
I made several attempts to correct common for causes of the
DllNotFoundException error (build as Release, build as 32-bit, check
Dependency Walker, etc) to no avail. Is there something SWIG-specific
I am missing?
I've made detailed notes of my process at
https://stackoverflow.com/questions/27534054 but if there's any other
detail I can provide, please let me know.
Many thanks,
Katherine
|