Migrating a project to Delphi prism from Delphi. net

Source: Internet
Author: User

As we know, now that the future of Delphi. NET is Delphi Prism (based on the remobjects oxygene compiler) We have to migrate our delphi. Net projects to be compatible with the prism compiler.

The easiest way to get started is to look at the free oxidizer tool provided on the remobjects wiki. the tool helps with the conversion of Delphi Win32 projects to Delphi Prism (but I'm uncertain about how it performs on Delphi. net to Delphi prism ). the Wiki is also an excellent place to get started, specifically the pages on Delphi Win32 vs Delphi prism which list the major incompatibilities between the two ages.

 

Whilst converting my delphi. Net Library for accessing Twitter, I encountered a few basic hints and tips which I felt I shocould share here:

  • You need to specifyNamespaceKeyword at the top of your unit file instead ofUnitKeyword. The first time I tried to compile after doing this prism still complained about not having a namespace keyword present, this was fixed by closing the solution and re-opening.
  • Delphi prism automatically makes classes that are not explicitly marked otherwiseStrict private. This meant that I had to go through my library and mark all classes that I wanted to make public. Eg.Tmyclass =PublicClass (system. Object );
  • TheOverloadKeyword isn' t neccesary as overloading is now implicit. this isn't a problem at all and isn't dificult to fix as it simply meant doing a search and replace for the overload keyword and removing it.
  • TobjectNo long exists and instead needs to be replacedSystem. ObjectWhich has much the same properties.
  • I encountered a few problems with the useFor... inLoops. it wowould seem That Delphi prism loop variables are local to the loop and therefore shocould be declared at the beginning of the loop (see the for wiki page for more info ). in reality this meant changing:ForStritemInListDoTo ForStritem: StringInListDoAnd then removing the stritem: string; declaration in the method var section.
  • TheTobject. Create ([...]);Constructor still exists however it is now recommended that you switch toNew object ([...])Keyword for new projects. This may come as a shock to traditional Delphi 'ers who have been. Create ()'Ing since the dawn of Borland but this is the construction method that sems to fit in with. net Framework better. there is also a compatibility flag in the project properties which allows the compiler to work some magic to allow. create to continue to function.

These are not the only changes that you will probably need to make but I found them to be a good starting point. you shoshould definitely consult the prism wiki for help in which I was able to find answers very quickly (No wading boots required !).

Lastly: My project cocould do with a lot of refactoring in order to take advatages of the unique language features of prism. This will take considerably more time as it means learning the new language features first!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.