Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2007

Tip: Looking for answers? Try searching our database.

Exporting classes to .Net world from a regular DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Note Myself - 12 Jun 2007 03:41 GMT
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
Brian Muth - 12 Jun 2007 05:31 GMT
>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
Alexander Nickolov - 12 Jun 2007 18:06 GMT
Brian, are you sure P/Invole supports non-C DLL exports?

Signature

=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

>>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
[quoted text clipped - 13 lines]
>
> Brian
Brian Muth - 12 Jun 2007 19:24 GMT
> Brian, are you sure P/Invole supports non-C DLL exports?

I think it has to be a C-style DLL export. Thanks for the clarification.

http://msdn2.microsoft.com/en-us/library/ms235282(VS.80).aspx

Frankly, I'd be inclined to put a COM wrapper around the C++ library. I'm
sure you feel the same way.
MrAsm - 12 Jun 2007 20:21 GMT
>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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.