Using C++ static library in managed code

P

Pranesh Joshi

Hi,

Does anyone know whether or not we can link a static library to a .NET
project and use the classes defined in the library?

The static library is built from C++ code base.

Thanks,
-PJ.
 
B

Ben Voigt [C++ MVP]

Pranesh Joshi said:
Hi,

Does anyone know whether or not we can link a static library to a .NET
project and use the classes defined in the library?

Yes, using the C++ compiler you can write C++/CLI code that uses the static
library, any other native libraries, .NET runtime, and is also usable from
other .NET languages like C#.

Another option is to use the C++ compiler to create a native DLL and
p/invoke it, but since you need C++ and a separate DLL either way, the first
way is better.
 

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