Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeInitializationException when using swig for C#

Tags:

c++

c#

swig

I am using a C++ framework for a c# project and using swig to connect them.

The problem is that TypeInitializationException is thrown every time when I try to create a C++ object wrapper.

C# code

TRPoint p = new TRPoint();

where TRPoint is a C++ struct

typedef struct {
    float x, y;
} TRPoint;

enter image description here

details:

enter image description here

I have a vc project that build the c++ code into DLL file but I don't know how to link it properly.

like image 766
Bryan Chen Avatar asked Jan 15 '12 20:01

Bryan Chen


1 Answers

The exception says "unable to load DLL" - it sounds like you've not built the C++ code that SWIG generates, or possibly got a path issue if it is built.

like image 176
Flexo Avatar answered Sep 17 '22 21:09

Flexo