2

Currently we have couple projects that are written in Delphi 6. Because of specific components that use in these projects (components also written in Delphi 6) it is not easy to convert it in newer version.

As I prefer .NET development and our new products are developed in .NET, I would like to develop new functionalities using these technologies. C# will be programming language.

My question is: How to integrate new functionalities developed in C# with current code in Delphi? Is this good idea at all and what can be possible issues? If someone have similar experience it would be to hear advantages and disadvantages.

I heard for integration in way to develop .dll with C# and use it from Delphi code.

TnX in advance!

Nemanja

Nemanja Vujacic
  • 925
  • 5
  • 14
  • 25

4 Answers4

6

You can use COM (ActiveX) both ways.

So Yes, you can make a DLL in C# and mark it as COM-visible and import it into Delphi.

But you cannot use simple (not COM) DLLs this way.

H H
  • 263,252
  • 30
  • 330
  • 514
2

My first port of call would probably be looking into WCF (written in C#) and have Delphi talk to it.

The dll is not a bad idea, but I just think putting it in WCF is more scalable + portable.

YS.
  • 1,808
  • 1
  • 19
  • 33
  • 1
    +1, why the downvotes? A large application normally will sooner or later include a of service / communication layer anyway. – mjn Mar 07 '12 at 06:22
  • Do you have any experience in WCF and Delphi 6,7 communication? Can you provide some examples? – Sasha Jun 18 '12 at 20:10
2

COM would probably be my choice. However, if for some reason you wanted to avoid COM you could take a look at the very nifty Unmanaged Exports by Robert Giesecke.

Unmanaged Exports is an MSBuild task that essentially allows you to export static functions from your .Net assemblies to be consumed as ordinary native DLL exports.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
1

You may want to check out Hydra from RemObjects. It permits native and managed code to be used in the same application.

http://www.remobjects.com/hydra/default.aspx

Alan Clark
  • 2,017
  • 21
  • 28