Exporting classes to .Net world from a regular DLL

N

Note Myself

I am writing a C++ library. I know that I can export classes through
dllexport keyword. However, we also need this library to be accessible from
..Net applications. Our original plan is to package it using COM. Is there a
way to expose these classes without adding COM layer? Thanks
 
B

Brian Muth

Note Myself said:
I am writing a C++ library. I know that I can export classes through
dllexport keyword. However, we also need this library to be accessible from
.Net applications. Our original plan is to package it using COM. Is there a
way to expose these classes without adding COM layer? Thanks

Yes, you can use a C++ Interop (or you can use PInvoke directly) to interact
with unmanaged code that uses dllexport.

You can read more about it here:
http://msdn2.microsoft.com/en-us/library/2x8kf7zx(vs.80).aspx

A newsgroup that is dedicated to this subject is
microsoft.public.dotnet.framework.interop.

HTH,

Brian
 
A

Alexander Nickolov

Brian, are you sure P/Invole supports non-C DLL exports?

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: (e-mail address removed)
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
 
M

MrAsm

Frankly, I'd be inclined to put a COM wrapper around the C++ library. I'm
sure you feel the same way.

I agree that the more robust way to reuse C++ libraries is wrapping
using COM. e.g. a DLL which exports C++ classes, built with
VS.NET2003, may have problems if used (without rebuilding) with
VS2005. If the C++ library has a COM wrapper around, those problems do
not exist.
COM is really a very good technology for binary code reuse, IMHO.

MrAsm
 

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