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

1
  • 2
    Primary options are exposing your Delphi code through a DLL with p/invoke, or exposing it via COM. Commented Mar 6, 2012 at 10:41

4 Answers 4

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

2 Comments

+1, why the downvotes? A large application normally will sooner or later include a of service / communication layer anyway.
Do you have any experience in WCF and Delphi 6,7 communication? Can you provide some examples?
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.

Comments

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

2 Comments

But does it allow to consume .Net code from within a regular Delphi application?
Yes, it enables .Net assemblies to be used in a Delphi application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.