HighTechTalks DotNet Forums  

Calling managed DLL from unmanaged C++

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Calling managed DLL from unmanaged C++ in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Kenneth Porter
 
Posts: n/a

Default Calling managed DLL from unmanaged C++ - 03-04-2010 , 06:36 PM






A vendor has supplied me with a DLL and .LIB of a C++ .NET wrapper around
their C API. No header file. My existing app is all unmanaged C++ with no
special MS libraries (like ATL and MFC). How do I hook this into my
existing solution?

With an unmanaged library I'd just #include the header and add the library
to the link inputs. What's the equivalent for a .NET library?

All the examples I'm finding go the other way, for calling an unmanaged DLL
from a managed language. I already know how to do that. (I needed a wrapper
for a customer using C#.)

Reply With Quote
  #2  
Old   
MarkusSchaber
 
Posts: n/a

Default Re: Calling managed DLL from unmanaged C++ - 03-05-2010 , 01:53 AM






Hi,

On 5 Mrz., 01:36, Kenneth Porter <shiva.blackl... (AT) sewingwitch (DOT) com>
wrote:
Quote:
A vendor has supplied me with a DLL and .LIB of a C++ .NET wrapper around
their C API. No header file. My existing app is all unmanaged C++ with no
special MS libraries (like ATL and MFC). How do I hook this into my
existing solution?

With an unmanaged library I'd just #include the header and add the library
to the link inputs. What's the equivalent for a .NET library?

All the examples I'm finding go the other way, for calling an unmanaged DLL
from a managed language. I already know how to do that. (I needed a wrapper
for a customer using C#.)
I see at least two possibilities:

- Try to register the .NET wrapper DLL as a COM server, and then call
into the DLL via COM. (This has the advantages of being less work, and
even allows you to bridge over 32/64 Bit boundary by using out-of
process hosting in case your code and the native C++ code is for
different architectures.).

- http://msdn.microsoft.com/en-us/library/9x0wh2z3%28VS.71%29.aspx
describes how you can host the CLR runtime, load the DLL into it, and
then call into it.

Markus

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.