Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I Use a .NET DLL in "Delphi 2007 for Win32"?

Is it possible to use a .NET DLL in Delphi 2007 for Win32? I've tried to import the DLL in the same way I've done for an ActiveX component, but it doesn't appear to work (Component Menu -> Import Component -> Import .NET Assembly.

Is it possible and if so what are the steps?

like image 732
Dave Avatar asked Jan 06 '09 15:01

Dave


3 Answers

If you want a Delphi specific article on doing that:

Using a .NET Assembly via COM by Jim McKeeth

It is pretty straight forward once you have all the steps.

like image 60
Jim McKeeth Avatar answered Nov 03 '22 23:11

Jim McKeeth


CrossTalk from Atozed Software allows to use .NET assemblies from Delphi without using COM, no DLL registration and can use original assemblies without modification.

http://atozed.com/CrossTalk

like image 23
user394033 Avatar answered Nov 03 '22 21:11

user394033


Sure you can. You just have to tell it what parts of your code should be accessible that way. You can do that through the ComVisibleAttribute. The quickest fix is putting [assembly:ComVisible(True)] in your .dpk which makes everything public visible. Then you can use the method you tried to import the assembly.

You can also do unmanaged exports which can be called like regular dll files.

like image 1
Lars Truijens Avatar answered Nov 03 '22 23:11

Lars Truijens