2xMax
2xMax

Reputation: 1752

Import MinGW C++ DLL in C# or VC++

I have a MinGW DLL with source code(~20k lines) and I need to use some classes from this DLL in CLR. At first I tried to write Manged C++ wrapper class for C++ class(that I just copied from the source code) and refer to this class from C#. But there are differences of VC++ compiler and MinGW, hence the native code compiles with some errors! I have no no big experience in C++ and ASM and it produces some troubles.

Tell me guys, is there a way to import a MinGW class in VC++ or C#?

UPD:

Differences MingGW and VC++:

  1. ASM invocation code like

asm("fnstcw %0\n" : "=m" (cw) : : "memory");
asm("fldl (%0)\n": : "r"(x): "st(7)"); };
asm("fstps (%0)\n": : "r"(x): "memory", "st");

not compiles in VC++. I have never written assembler code harder than MOV AX, BX:)

  1. It also executes fortran code and I don't understand how:)

Upvotes: 2

Views: 3439

Answers (1)

Artyom
Artyom

Reputation: 31243

Few points:

  1. You can't use C++ DLL, but you can use C DLL as any other native DLL.

    See: http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs

  2. About the code - it changes some FPU options so if you want to port it to C#/.Net you should first understand what it does.

Upvotes: 5

Related Questions