Hi,
Is it possible for a non-.net C++ application to use a .NET DLL file?

Thanks in advance,

Tim.

Re: C++ and .NET compatability by Ian

Ian
Mon Nov 22 08:23:52 CST 2004

"Timothy V" <tripix@msn.com> wrote:
> Is it possible for a non-.net C++ application to use a .NET DLL file?

You can expose .NET classes through COM, thus making those classes accesible
to a non-.NET C++ application. You can export a type library for the .NET
component using the TLBEXP tool, and you can register it for use through COM
with REGASM.


--
Ian Griffiths - http://www.interact-sw.co.uk/iangblog/
DevelopMentor - http://www.develop.com/



Re: C++ and .NET compatability by Niki

Niki
Mon Nov 22 10:24:00 CST 2004

"Ian Griffiths [C# MVP]" <ian-interact-sw@nospam.nospam> wrote in
news:%23q4Co7J0EHA.1196@TK2MSFTNGP15.phx.gbl...
> "Timothy V" <tripix@msn.com> wrote:
>> Is it possible for a non-.net C++ application to use a .NET DLL file?
>
> You can expose .NET classes through COM, thus making those classes
> accesible to a non-.NET C++ application. You can export a type library
> for the .NET component using the TLBEXP tool, and you can register it for
> use through COM with REGASM.

In addition to that, you can also create a .NET DLL with MC++ that is
directly accessible from unmanaged code (like any other DLL), or you can
host the CLR (see for example the .net command-line debugger cordbg)

As a rule of thumb:
- COM interop is quite easy to use, but it has a little performance overhead
- creating an MC++ wrapper is very flexible, but it is more work, too
- hosting the CLR directly is *quite* complex - if you don't intend to write
a debugger, profiler or something alike, it's probably not worth the effort

Niki