Managed C++ wrapper problem

P

Pepa Cougar

Hello,

I'm trying to write a managed C++ wrapper for my old C++ classes but I
encountered a following problem:

I have two .lib files with the old unmanaged code. Both libs are set
to use *static multithreaded runtime library*.

I wrote a managed C++ library which wraps the unmanaged code. The
library is compiled as a DLL library (.NET assembly) also with static
multithreaded runtime library.

Now I have a testing C# application which imports the wrapper
assembly. But whenewer the C# app tries to create an instance of any
wrapper class, it crashes (NullReferenceException). It crashes at the
point where the managed class tries to (internally) create an instance
of the underlying unmanaged class.

Ok, but the funny thing is, that if I switch the runtime library to
multithreaded DLL, it doesn't crash anymore. What could be the
difference between static and DLL runtime libraries in this case? Can
anyone give me any pointers, because I'm becoming pretty hopeless...

Thanks in advance.
 
D

Dirk

Are the old libs compiled with the same static runtime as the wrapper or are
the libs created with an older version of vs?
 
P

Pepa Cougar

Dirk said:
Are the old libs compiled with the same static runtime as the wrapper or are
the libs created with an older version of vs

Everything is compiled under Visual C++.NET 2003 :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top