Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top