views:

147

answers:

3

Hello, following my post "Writing a C++ DLL, then wrapping it in C#.", i managed to create a C++ DLL and wrap it in C#, and everything works smooth... Well, only on my dev machine. While the code compiles on other machines too, i just won't run.

Some background. I create a dll that uses cvblobslib that is based on opencv. I compiled all dlls/libs for win32 and target machine: x86. The exception that is thrown, is for some opencv call that i make inside my dll:

Unhandled exception at 0x00dbe012 (cv200.dll) in ConsoleApplication1.exe: 0xC000001D: Illegal Instruction.

Of course, all dlls and everything all located in the same directory as the c# executable is run from.

Any thought and idea would be much appreciated because i am stuck and it's really annoying that it runs on my dev-machine and nowhere else! >.<

A: 

You also need to make sure that you C# code target's x86. If the C# code is set to anyCPU (which is the default) it will run as 64 bit on a 64 bit machine.

Both the C# assembly and the C++ dll need to target the same architecture.

Scott Wisniewski
A: 

Thanks a lot guys for your interest. It seems that opencv explicitly uses sse2 and my athlon xp does not support it. I modified some header files and everything runs ok now :-)

makism
A: 

Can you post the changes you made to the include files? I'll be working on something very similar soon and will likely see the same problem. Thanks.