views:

205

answers:

3

Possible Duplicate:
Create a C# DLL That Can Be Imported in a Delphi App Using stdcall - Possible?

I am creating a c# library and like to make this library as com component which can be accessed from delphi. Please tell the how to achieve this.

A: 

I won't rewrite, but there is a solution on how to do this here : http://forums.devshed.com/delphi-programming-90/c-dll-need-to-be-used-in-delphi-231122.html

Amadeus45
A: 

If you aren't opposed to using VB instead of C# there's a cleaner solution. In VB you can use the ComClass item template which does virtually all the work to expose your .NET type to COM for you.

Rob Windsor
+2  A: 

How to make .Net (C#) classes accessible through COM is described here. Basicly your classes need to have a default constructor without parameters and you need to decorate your classes with some specific attributes. Then you need to register your assembly using regasm.

Then you can import the ActiveX/COM library in Delphi and call it like it was a regular ActiveX/COM Library.

Lars Truijens