Re: Consuming a .NET class exposed through COM?
- From: "Michael Latta" <lattam@xxxxxxx>
- Date: Thu, 20 Jul 2006 22:04:09 -0700
Yes I have done this in .Net 2.0 using VisualStudio.
There are a couple threads out there that are helpful but mostly they talk
about 1.1.
Youj need to generate a TLB from your .Net assembly, and get it registered
in the Registry. Then the class needs to implement an Interface that has a
GUID and itself has an attribute that disables the default generated
interface. The tool you want is regasm. Your use of auto dual might work
as well, but the example I had used an explicit interface so you could
request the interface from the IDispatch inside Dolphin.
I had planed to take this farther and build a general framework for .Net
interop, but get derailed by a large contracting project. The performance
on this is not all that good. This is on the order of 50X the Smalltalk
dispatch speed. It was recommended to me to look at managed C++ which could
provide a more efficient interop path than COM and could be used with the
CLR hosting tools.
If you GOOGLE "CLR Hosting" you should find several good articles.
Michael
"Griff" <grettke@xxxxxxx> wrote in message
news:1153173274.202336.196080@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I've previously written a .NET 1.1 class that is exposed through COM by
using
1. Class attribute [Guid("guid-here")]
2. Class attribute [ClassInterface(ClassInterfaceType.AutoDual)]
3. Implementing the class to be COM compliant language friendly (no
exceptions, or constructors), specifically VB6
4. Generating a strong name key file
5. In the assemblyinfo.cs: locking the version to 1.0.0.0 and
specifying no-delay signing along with the key file
6. Created an installer to register this dll as a COM compatible and
consequently a type library entry for it so COM clients would be happy
This was deployed and works great with VB6. I've tried the same thing
with .NET 2.0 and D6, but it fails to open the DLL with a walkback
starting with "HRESULT Error: Error loading type library/DLL".
Right now I am thinking that I could:
1. Try this with VS.NET 2003, .NET 1.1
2. Try to find more documentation about how to do this in .NET 2.0,
seemingly it is easier now
3. Find someone else who has already accomplished this
So, have any of you already tried this successfully with either .NET
1.1 or 2.0?
.
- Prev by Date: Re: VM Crash
- Next by Date: Misbehaviour or by design -- CHB
- Previous by thread: Re: Dolphin X6 ActiveX Error
- Next by thread: Misbehaviour or by design -- CHB
- Index(es):
Relevant Pages
|