I composed .Net 3.5 dll with single method, which is to be called by Delphi .exe. Unfortunately it does not work.
The steps: 1. Create C# 3.5 dll with the code:
public class MyDllClass
{
public static int MyDllMethod(int i)
{
MessageBox.Show("The number is " + i.ToString());
}
}
- Go to Assembly Properties --> Assembly Information and checked the "Make Assembly COM-Visible"
- Used RegAsm.exe to register my dll
This throws Delphi exception which indicates it cannot connect the dll. What are the steps required to enabled usage of C# managed dll from unmanaged code.
Does any one familiar with good example about the subject?
Thank you
After massive investigation I found the solution: it's all about registration parameters. The flag /codebase must be added to the regasm command.
Many posts out there suggest to use Guid and other COM attributes on the C# Com exposed object, I managed to deliver COM functionality using the ComVisible(true) attribute and regasm /tlb /codebse command.
The code:
and as I mentioned I used regasm.exe /tlb /codebase to register it