Reputation: 5644
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?
Upvotes: 16
Views: 12665
Reputation: 21
CrossTalk from Atozed Software allows to use .NET assemblies from Delphi without using COM, no DLL registration and can use original assemblies without modification.
Upvotes: 2
Reputation: 38743
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.
Upvotes: 10
Reputation: 43635
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.
Upvotes: 1
Reputation: 2487
I don't think you can do that, directly mixing managed and unmanaged code in the the same app.
However RemObjects have a framework called Hydra that allows you to use .Net and Win32 in the same application.
Upvotes: -1