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;

details:

I have a vc project that build the c++ code into DLL file but I don’t know how to link it properly.
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.