Skip to content

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

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.

{ 6 } Comments

  1. Gary Olson | December 21, 2012 at 4:57 pm | Permalink

    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.

  2. David Intersimone | December 21, 2012 at 5:52 pm | Permalink

    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

  3. Gary Olson | December 22, 2012 at 5:34 am | Permalink

    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.

  4. Chris Rolliston | December 22, 2012 at 11:40 am | Permalink

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

  5. Gary Olson | December 22, 2012 at 3:44 pm | Permalink

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

  6. David I | December 23, 2012 at 10:22 am | Permalink

    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 :)

Bad Behavior has blocked 4 access attempts in the last 7 days.

Close