Working with .NET classes in Delphi by using mscorlib

250 Views Asked by At

I would like to use .NET classes in Delphi. I included mscorlib unit (which is a TLB) and want to create an instance of e.g. Assembly class. So I have:

uses mscorlib;

var myAssembly: _Assembly;

begin
  myAssembly:=CoAssembly.Create;
  ...
end.

The application is compiled successfully, but when starting it I get an error message saying that the class is not registered.

Any idea how this can be solved?

1

There are 1 best solutions below

0
On

By using mscorlib for delphi to call c#.

You can take a look at JEDI or DDNRuntime.

TJclClrHost in JEDI.

DDNRuntime is wrapper for delphi to call c#.

Features

  • No need for COM support.
  • It is very simple to use, just declare the type and method of .NET in Delphi.
  • Dedicated translation tool, input one or more .NET assembly DLL, output one or two Delphi import units.
  • Support interface types.
  • Support dynamic array (one-dimensional array).
  • Support Delegate type.
  • Support Event.
  • Generic type (Limited support. Only XE8 and above are supported and nested generics are not supported yet, such as: DNICollection<DNKeyValuePair<TKey, TValue>> such multi-level nesting).

https://github.com/ying32/DDNRuntime-examples