Link to home
Start Free TrialLog in
Avatar of Doug Van
Doug VanFlag for Canada

asked on

Converting Dephi code to any Visual Studio Language (VB, C++, C#)

Hello folks,

There are a huge assortment of language converters out there, so this question may not seem as far fetched as it appears.

I have a relatively simple program written in Delphi (files consists of .cfg, .dof, .dpr, .res, .dcu, .ddp, .dfm, .pas), and I need to make some changes to it but I do not own the Delphi compiler.

I am looking for a tool that will convert this code to any of the Visual Studio family of languages.

Someone please make my day. :-)

BTW, EE doesn't seem to have a Visual Studio general zone!?!?
Avatar of Doug Van
Doug Van
Flag of Canada image

ASKER

BTW, I am looking into a bunch of conversion tools located here: http://www.torry.net/pages.php?id=1518

But I would prefer to hear from someone who has actually used any conversion tool.
ASKER CERTIFIED SOLUTION
Avatar of systan
systan
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Systan, great find. Have you ever used this tool? I am wondering how good it is. I noticed that the demo can handle up to 500 lines of .pas code. This is perfect!

SOLUTION
Avatar of Emmanuel PASQUIER
Emmanuel PASQUIER
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
epasquier: Are you suggesting that Delphi is a better language? This is not a fighting question, I am very curious. I am especially curious about how a language (re: Pascal) originally invented for teaching programming has enjoyed so much success, especially in the form of Delphi.

My problems with Delphi, however, are that at one point it seemed quite dead-ended... with no ability / support for 64bit Windows and cross-platform. But so many companies... Borland, CodeGear, Embarcadero have been involve.... I really don't know what the status  of Delphi is now... and I don't know exactly if Embarcadero Delphi XE is the latest and what it offers and/or if there is other competitor versions.

I will say this.... the code that I have written with Delphi from a few years back is still robust and works extremely efficiently with a very tiny footprint. I cannot say the same about Visual Studio code that requires a bulky (and sometimes buggy) .NET framework of a specific version.

Alas, I no longer own a legitimate copy of Delphi (2007), so my only option is to convert or rewrite.

I will let you all know how I made out with the conversion.
sconnell?
If your concert about 64bit windows support
try LAZARUS
http://wiki.lazarus.freepascal.org/Screenshots
When you install Lazarus, then Lazarus has been opened,  just go to Tools Menu then click "Convert Delphi Project  TO Lazarus Project".

Lazarus will convert the delphi components to lazarus components.

If delphi components error on lazarus?, an option will appear that will lead you to the right direction.

eq.,

TADOConnection in Lazarus is TODBCConnection which uses ODBCConn

TADODataSet in Lazarus is TSQLQuery which uses SQLdb

 

sample:

uses SQLdb, ODBCConn, .......

TDBClass = class
  private
    // a data set to mantain all templates of database
    dsTemplates: TSQLQuery;
    // the connection object
    connection: TODBCConnection;
    // SQL Transaction
    SQLTransact: TSQLTransaction;

    ...

public

   ...

end
Pascal/Delphi language is successful as an educational language and as a professional tool for the same reason : it is very structured, its syntax is highly readable and completely fool-proof.
If your algo is correct, and it compiles, then it will work. period. even if you write code in the middle of the night with 2g of alcohol in the blood. Which is not the case by far with C/C++/Java/C# syntax

I could write a complex application of 1000+ lines of object code in a straight row, try to compile, correct all the typo mistakes reported by the compiler, run it and enjoy the fact that it works in the first attempt. C code and derived languages MUST be tested function by function, because a simple misplaced character can compile and throw your application out of the window, and if you have wrote 1000+ lines of code, good luck to find the small ; missing that cause the bug.

If you consider also the fact that a code written in Pascal 3.0 for DOS can be compiled without much changes with Delphi 2010 and run in Windows 7 64 bits, then you have a record of longevity that is only beaten by C, but even C will give you hard times because of all the changes in the system function names and parameters. For example, I have made an application with Pascal 5, in the mid 90's, which purpose was to define geometric figures (circles, lines, etc.. defined by geometric rules like (D) = parallel line going through point A ), so using old pascal graphic libraries and lots of math code.
A few years ago, I decided to port it to Delphi. I just had to throw all the code that was about the user interface and replaced it with Delphi VCL components (menus, buttons), and replaced the graphic rendering of the figure with DirectX functions calls that I wrapped around functions with the same names and parameters as old Pascal graphic library, and it worked like a charm. Total conversion took a single day, for a 5K+ lines of code that took me months to write (original app size around 15k lines of code, the difference being all those nice GUI VCL components doing all the hard stuff for me in Delphi)

If you ever find a language with that same efficiency, let me know.

About the Delphi future : I can still create professional applications with Delphi 7 more quickly than with .Net, which means 10 years old for a single version of a development environment and still kicking ass.
I will probably switch to Delphi XE in the next months, but only because I'd like easier modern look support and a few nice features to help me work even quicker. But really I could go on with Delphi 7 for a few years more if I was forced to.

With all the advantages it has, I don't think Delphi will disappear so soon. Maybe it will be less frequent to see in big companies that worry too much about future and choose software platform like yoghurt in the supermarket (marketing influenced decision), and that don't want to spend time training their employees to use anything else than "standard" environments - even if it could bring quickly a return on investment.
But that doesn't matter for me, I'm working for myself, and my clients just care about the time it takes for me to create the applications they need, and so the cost for them. The less Delphi developers are around, the more I can make a difference compared to their alternatives.

Since Embarcadero is still working hard to bring Delphi to the top of modern dev tool, I'm sure that even if they stop in a few years I will still be making Delphi apps in the next decade or two. After all, even the 32 bit limit (that will be broken soon) is not such a limitation because it's easy to circumvent with multi-process applications working together. So, yes, Delphi is definitely a better tool than most of others, as long as you only need Windows applications.
epasquier: Ha! You were right to be skeptical. Unless I am doing something wrong, the netcoole tool is utterly useless. It truly made a mess of the code (but seemed to translate the form okay).

I think I am better off starting from scratch or just purchasing Delphi for my other many projects.

Thanks systan. :-)
epasquier:
>So, yes, Delphi is definitely a better tool than most of others, as long as you only need
>Windows applications.

In the past, Delphi could compile to Linux. Is that no longer the case?

Thank you for your input. It is always interesting to see another perspective.

In terms of career advancement, very few organizations (actually I can't name any) want Delphi coders. That is not saying anything bad about the language or syntax itself...it is just the current reality. In fact, recently Adobe just released Captivate 5, which was a complete re-write of the code to C++, from the original Delphi language.

But, I do agree on ease of use and its good structure.
Thanks folks!

Systan won because... it was the right solution. I never specified that it had to work [perfectly]... oh well. sigh..

I also gave points to epasquier for your excellent/useful comments.
Yeah, what's ~900€ for such a great tool (Delphi Pro XE)... ok, I admit that is a bit expansive but well worth it.
> In the past, Delphi could compile to Linux. Is that no longer the case?
yep, Kylix ... That was not perfect as it was using another set of components (CLX) instead of VCL. Close, but not close enough so that it didn't need some work to make an application compile on both platform.

today, you can give a try with Lazarus. Not too bad either, I haven't tried it myself but some says it is getting better and better.

Embarcadero is working on a real cross-platform version of Delphi (Mac & Linux), surely they had learn a lot from Kylix experience. It is a fact that when you try to tackle some very complex task such as a cross-platform compiler, you often need at some point a complete rethink/rewrite of the project, using the experience gained on the first attempt but not having to keep compatibility with the wrong designs. That takes time, but I'm confident that we will be happy with the result when it comes. I prefer they do not rush things and make it right this time... And I'm sure they know that it can be THE argument to compete on a large scale with other languages.
Thanks

epasquier
do you think lazarus is not worth to use? it support cross platform, even with msmobile, and support 64bit to any os you want to use.
I said Lazarus is not too bad, but I'm only reporting what I've heard. I think it can be worth it, to create simple tools that need to work on both systems. I'm not sure if it can produce beautiful / user friendly interface as well as Delphi can, and especially because it might not work with as much profesionnal components set that are maintained for Delphi.

I would not say it's not worth it.

About 64 bit : there is a lot of talks about Delphi not supporting 64 bits. I'm really wondering if more than 5% of the talkers knows how small an issue that is. There is absolutely NO problems with 32 bits applications running in 64bits system. Quite the opposite in fact. I'm running Delphi 5,7 & 2007 on Vista 64, and all my applications compile & works fine.

A 64 bit compiled application will NOT work on 32bit system. So every application that needs to work everywhere will HAVE TO be able to compile & work also in 32bits version. Which means that the design of the application MUST restrain to 32bits limitations, and only implement some 64bits optimizations (key functions that have to be implemented in both versions and switch at compile time)

The key benefits of 64bits are for applications that need :
- heavy calculations on 64bits int (ex: maths problems solving). How many of Delphi developers where ever limited by the 4G values possible in 32 bits int ? most of the variables never hold values more than a few hundreds, maybe thousands
- huge memory requirements (more than 2GB). Again, how many developers create applications that can hold in memory a significant part of their hard drive ? and to be a significant leap forward you would have to run on a system with 6, 8 or maybe 10 GB of memory, otherwise your application would be swapping madly. And if you have such a 64bit system with that much memory, you could design your application to spawn different 32 bits PROCESSes (not threads), each limited to ~2GB, all working together, communication between them with TCP/IP in the local loop for example. You would then have the benefit of being able to extend easily this system of applications to run those processes on multiple MACHINES, therefore doing LOAD BALANCING, which is a much better design that a single process addressing 64bits memory space all by itself.

Which means, all combined, that there is only one out of millions of applications that really could use 64bits compilation, and none that absolutely need it.
epasquier your really a delphi VETERAN, a real genius not only in delphi.

Thank you, I have to go back to our conversation on my other post.
 I think your 40s. ;)