The 25 days of C++mas - December 19 - Migrating C++Builder Code to 64-bits (2)

Posted by on in Blogs
In my first blog post about Bruneau Babet's CodeRage 7 C++ session, "Migrating C++Builder Code to 64-bits", I covered some of the language extensions added to support Win64 and integration with Delphi language features.  In part two I'll list a few more of the migration items that Bruneau presented.  With C++Builder XE3 64-bit, you can generally take your C++ 32-but VCL and FireMonkey applications, add the 64-bit Windows target platform and do a rebuild.  But, since the 64-bit compiler is based on a different compiler (and just like with Delphi 64-bit migration), there will always be  some Win64 adn 64-bit considerations that you need to take a look at.  Many of these items are also documented on the Embarcadero DocWiki at http://docwiki.embarcadero.com/RADStudio/XE3/en/C%2B%2BBuilder_64-bit_Windows_Application_Developmenthttp://docwiki.embarcadero.com/RADStudio/XE3/en/What%27s_New_in_C%2B%2BBuilder_64-Bit_Windows and http://docwiki.embarcadero.com/RADStudio/XE3/en/BCC64.EXE,_the_C%2B%2B_64-bit_Windows_Compiler.

Linking libraries and objects

If you have separately compiled object and library files, you'll need to be aware of the differences in file extensions. In using the "#pragma link" and "#pragma comment", Bruneau gave the following advice:

  • #pragma link “<obj-name>” - Remove extension: WIN32 will default to .obj and WIN64 to .o

  • #pragma comment(lib, “<lib-name>”) - Remove extension: WIN32 will default to .lib and WIN64 to .a


Differences in IDE generated event handlers

Watch for differences between WIN32 and WIN64 in IDE-generated event handlers. E.g. TPoint and other records 5-8 bytes long fit in a register in WIN64 but are passed by reference in WIN32.

Cool in C++ 64-bit compiler

Not so cool in C++ 64-bit compiler

Future (maybe?)

Watch/Download the C++Builder 64-bit Compiler Preview Video

Additional details about the 64-bit C++Builder compiler are available in the preview video.  Watch the C++ 64-bit compiler preview video on YouTube at http://www.youtube.com/watch?v=PwwMpBUoR6Y. You can also download the MP4 video file at http://cc.embarcadero.com/item/29197.  The preview video is 9 minutes long.

Try the C++Builder 64-bit compiler

The C++Builder XE3 and RAD Studio XE3 free trial downloads have been updated to include the new C++Builder 64-bit compiler.  Trial downloads are available at https://downloads.embarcadero.com/free/c_builder

Happy C++mas!

During the first 25 days of December leading up to Christmas, I will blog about the release of the C++Builder 64-bit compiler for Microsoft Windows and C++Builder XE3 support for building VCL and FireMonkey 2 applications.


About
Gold User, Rank: 1, Points: 2466
David Intersimone (known to many as David I.) is a passionate and innovative software industry veteran-often referred to as a developer icon-who extols and educates the world on Embarcadero developer tools. He shares his visions as an active member of the industry speaking circuit and is tapped as an expert source by the media. He is a long-standing champion of architects, developers and database professionals and works to ensure that their needs are folded into Embarcadero's strategic product plans. David holds a bachelor's degree in computer science from California Polytechnic State University at San Luis Obispo, California.

Comments

  • Guest
    Gary Olson Friday, 21 December 2012

    Where is the 64 bit choice in the IDE. I tried to copy the code
    but when I compiled it did not like the __asm__ in the code.
    the IDE is choosing the 32 bit compiler instead of the 64 bit compiler. I have C++ XE3 update 1.

  • Guest
    David Intersimone Friday, 21 December 2012

    Right mouse click on the Target Platform node in the Project Manager view - choose Add Platform, then select 64-Bit Windows target. The check box will also make this the active target node. then you can build 64-bit Windows apps. This is detailed in my blog post at http://blogs.embarcadero.com/davidi/2012/12/20/42150

  • Guest
    Gary Olson Friday, 21 December 2012

    Thank You. I see now. Should have looked at Dec 14 example first.

    Looking at Dec 14, I see the size of the integer is 4 bytes. In the 64 bit compiler, I thought that the integer would be sized to 64 Bytes.

  • Guest
    Chris Rolliston Saturday, 22 December 2012

    @Gary Olsen: Win64 keeps int at 4 bytes. It would be wrong for EMBT to arbitrarily go against platform norms.

  • Guest
    Gary Olson Saturday, 22 December 2012

    Thanks, I need to read up more on 64 bit windows

  • Guest
    David I Sunday, 23 December 2012

    Gary - yes Int stays at 4 bytes in C/C++ (all compilers even Microsoft) and Integer is 4 bytes in our Delphi 64-bit compiler as well :)

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: