views:

456

answers:

3

Hi,

I've got an old project written in Delphi 4. I'm looking for a way to:

  1. use that code with minimal changes from within .NET
  2. use other .NET assemblies from that Delphi code
  3. use Visual Studio to work on the solution which will contain Delphi project and C# projects.

Is that possible? What will i need for that?

Thanks

+2  A: 

If your Delphi code is already in the form on COM-based libraries, it can be called from .net through a RCW (runtime callable wrapper,) which is auto-generated by the IDE when you add a COM component as a reference. Similarly, any component you would like to call from Delphi can be wrapped in a CCW (COM callable wrapper) and called as if it were native.

Jekke
+8  A: 

Unfortunately, no.

CodeGear never supported Delphi for .NET in Visual Studio in any version, and VCL for .NET died after Delphi 2007.

The new "Delphi" .NET solution is Delphi Prism, which does work in Visual Studio; unfortunately, it isn't backwardly compatible with Delphi code. Rem Objects (the actual owners of the Prism compiler, formerly known as Oxygene) has made available a utility application that attempts to convert the syntax differences automatically, but I haven't tried it on anything yet.

You might be able to reuse some of your old Delphi 4 code by converting what you can to ActiveX controls and using COM to make them available in .NET. Then you can use C# in Visual Studio (along with Prism, if you want or need it) to do what you need.

Ken White
+4  A: 

You could have a look at Remobjects Hydra This will allow you to mix win32 and .net assemblies. Not sure if Delphi 4 is supported, but you should have no problem porting to a later version of Delphi that is supported.

Steve
+1 I was actually in the middle of suggesting that when you posted your answer.
Jim McKeeth
You've beaten me to a few before. Payback! :)
Steve