views:

116

answers:

1

How does one go about exposing a class written in Prism via COM Interop? For example, given the following interface:

TYPE
  IFoo = public interface
    property bar: string; read;
  end;


  FooImpl = class( IFoo )
  private
    function GetBar : string;
  public
    property bar: string; read GetBar;
  end;

In this example, assume IFoo was imported via TLBIMP and linked to the project.

+1  A: 

use the ComVisible attribute to make the assembly and/or class public. When using tlbexp.exe (part of the .NET SDK) you'll get the interface as a COM interface and the class as a CoClass for IFoo. Optionally you can use the Guid attribute to set a specific guid for your interface and (co) classes.

Ck

related questions