4

Does any one know of a Delphi to .NET converter (either C# or VB.NET)? I've inherited a bunch of Delphi code, never seen Pascal before and rather than learn it, I'd rather just try to use an automated converter, if available, and clean up the code after that. Can't seem to find this kind of tool anyway I search - maybe that's because one doesn't exist - so I thought someone here may know.

Todd Main
  • 28,951
  • 11
  • 82
  • 146
  • 1
    And the Delphi code is regular win32 Delphi code? Or is it Delphi for .Net or even Delphi Prism? – Lars Truijens Sep 04 '10 at 20:09
  • 1
    I don't think it's Delphi for .NET, looks like Win32, has forms, a bunch of things that start with `T`. – Todd Main Sep 04 '10 at 20:15
  • 2
    You have the opportunity to learn a new language and you are turning it down? I'm disappointed. – JeremyP Sep 04 '10 at 20:42
  • 2
    @JeremyP: My life is full of regrets. I may have to wait a while before I figure out if this will be that. But I've heard that Delphi compiles to machine code and deploys as a single exe - doesn't get much cooler than that. – Todd Main Sep 04 '10 at 20:49
  • possible duplicate of [What tools exist to convert a Delphi 7 application to C# and the .Net framework?](http://stackoverflow.com/questions/59547/what-tools-exist-to-convert-a-delphi-7-application-to-c-and-the-net-framework) – Rob Kennedy Sep 04 '10 at 21:59
  • 1
    Well, it's now 3 years later and I have no regrets for not learning Pascal... – Todd Main Dec 04 '13 at 16:53
  • Seem to be getting a lot of downvotes on this one lately - the Borland holdouts are out in force and they are angry! It's 9 years later and I still don't ever need to learn Pascal. – Todd Main Nov 05 '19 at 16:51

2 Answers2

12

Spare your time.. If you want to convert code because you don't understand or like the original language, my advice is: "Don't bother" (believe me, I've made numerous attempts to convert code). Especially if you're planning to just make a couple of small changes to the existing code.

You won't be able to convert the code and have it compile, let alone run flawlessly.

You might be able to translate portions into something that is syntactically correct, but you won't have the libraries or frameworks (RTL/VCL) that the software relies on.

You're going to have to go back to the Delphi code and be able to understand what's happening to fix parts that are not working. It's going to take more time to fix bugs in the generated code than it would take to study the existing code and rewrite it entirely.

And if you have the time to rewrite software in another language, you might as well just roll up your sleeves, learn the original language, and change what you need to change in the existing code.

Wouter van Nifterick
  • 23,603
  • 7
  • 78
  • 122
  • 2
    -1. Sound ridiculous to me. There are just too many technologies out there to try to learn them all. – Stan Sep 07 '10 at 00:45
  • 5
    @ChickenDinner: Nobody promised that programming is easy, and nobody said that you need to learn *all* technologies. But if you "inherit" code, you're pretty much f*cked if you don't understand the language, and no code-converter is going to save your ass. That's my point basically. – Wouter van Nifterick Sep 07 '10 at 14:01
9

I have no experience using these tools, but here are a couple:

Delphi2CS

TurnSharp

A similar question was asked:

What tools exist to convert a Delphi 7 application to C# and the .Net framework?

Community
  • 1
  • 1
Edward Leno
  • 6,257
  • 3
  • 33
  • 49
  • 1
    Good stuff. Now see, there's something wrong with search here. I had tried http://stackoverflow.com/search?q=delphi+to+c%23 and it didn't kick that link. – Todd Main Sep 04 '10 at 20:14