Groups | Blog | Home
all groups > dotnet interop > december 2006 >

dotnet interop : Can .NET Class Implement a COM Interface?


Joseph Geretz
12/7/2006 5:01:18 PM
We provide the ability for third party developers to add their own 'Plugin'
modules to our application, by providing developers with an interface
definition (IPlugin). As long as their classes implement our IPlugin
interface our application can ommunicate with them. Classic VB6 interface
inheritance.

Recently, we've been getting more and more requests from vendors who want to
use .NET to create their extensions. Up to this point, the advice we've been
giving them is to create a shim class in VB6 which implementes the required
IPlugin interface and then use interop to instantiate whatever .NET classes
they want to create as their own application implementation.

My question is, is the shim absolutely necessary? Or is it possible to
create a .NET class which implements the IPlugin interface directly? And if
so, would the Interop wrapper generated implement the IPlugin interface as
well? If so, it would be possible to dispense with the VB6 shim class
altogether. Or is this shim class absolutely necessary for this scenario?

Thanks for your advice.

Joseph Geretz

Forbes
12/9/2006 7:01:00 AM
You can use the tlbimp.exe the import the dll as a assembly, and use
ildasm.exe to see the interface detail, implement the interface by using it
as reference.

[quoted text, click to view]
TDC
12/11/2006 5:32:38 AM
You don't need the shim. .NET can absolutely implement the interface.


You could even implement the interface in .NET yourself and then give
the .NET clients an inheritence-based API. (This might be cleaner for
..NET-based development since you don't have to require the client to
mess with COM Interop registartion issues.

Tom

[quoted text, click to view]
AddThis Social Bookmark Button