BCC64X

From RAD Studio
Jump to: navigation, search

Go Up to Clang-enhanced C++ Compilers


BCC64X is a RAD Studio C++ compiler for 64-bit Windows (Modern).

BCC64X is based on Clang. For more information about what the BCC64X compiler has in common with other Clang-enhanced C++ compilers, see Clang-enhanced C++ Compilers.

Note: For 32-bit Windows, use BCC32C (Clang-enhanced compiler) or BCC32 (previous-generation compiler).

General Information

Field Value
Clang Version 15.0
LLVM Version 15.0
Calling Conventions Microsoft x64
Name Mangling Itanium
Standard Library LLVM libc++
C++ Runtime Custom based on MinGW-LLVM
C Runtime UCRT

Output Files

File Type File Extension File Format
Executable .exe PE64 (PE32+)
Shared Library .dll PE64 (PE32+)
Static Library .lib library of object files
Compiled Object .o COFF64
Debug Information .pdb PDB
Note: The new clang only supports linking packages statically, providing most of the Delphi packages as .lib files. You can link these files to your EXE or DLLs.

Toolchain

The Windows 64-bit Modern C++ toolchain (bcc64x) is an entirely new implementation of the Clang extensions and C++Buidler features with new platform-standard technology. With an LLD linker, the new Clang toolchain is our recommended C++ toolchain.

It uses the LLVM libc++ STL, a custom C++ RTL, the Windows UCRT for the C runtime, and emits object files in COFF64 format with PDB debug info.

To add this toolchain to your existing C++ project, perform the following steps:

  1. Right-click the Target Platforms node in the Projects treeview.
  2. Select Add Platform.
  3. Choose Windows 64-bit (Modern).
Note: You can toggle between the old and new Win64 platforms easily because both are installed and can be added to a project side by side, allowing easy upgrading.

Creating DLL Import Libraries

To import a .dll file, you need an import library. The toolchain supports any existing COFF library; however, you can create your own.

To create your own import library (.lib) file, follow the steps below:

  1. Get the definition (.def) file for the DLL.
    Note: To get the .def file, users can use the gendef.exe file from LLVM-MinGW. Note that this tool does not ship with RAD Studio and must be downloaded separately.
  2. With your gendef.exe copy, run the following command to create the .def file:
    gendef file.dll
    
    Note: A .def file is plain text, open the file and ensure it contains LIBRARY <dllname>.dll with the correct <dllname>.
  3. Use the new LLD linker to generate the import library by running the following command in the RAD Studio Command Prompt:
    ld.lld.exe -m i386pep --out-implib file.lib file.def
    

The IDE automatically creates your DLL import library when building, but you can also do this manually by running any of the followings codes in the command line:

bcc64x -tD -Xlinker --out-implib=dll.lib dll.cpp

or

bcc64x -tD dll.cpp -Wl,--out-implib,dll.lib

See Also