Using TMS VCL UI Pack in 32bit or 64bit applicationsTMS VCL UI Pack supports development of both 32bit and 64bit Windows VCL applications with Delphi and C++Builder. This article describes the steps needed to succesfully create 32bit and 64bit Windows VCL applications using TMS Components.
Introduction: TMS VCL UI Pack package structureTMS VCL UI Pack comes with following packages:
- TMSDXE*.DPROJ: Run-time & design-time package containing components
- TMSEXDXE*.DPROJ: Run-time & design-time package containing components
- TMSDEDXE*.DPROJ: Design-time only package with component designers
- TMSXLSDXE*.DPROJ: Run-time & design-time package containing XLS support
- TMSWIZDXE*.DPROJ: Design-time only package with IDE wizards for components
As the Delphi or C++Builder IDE is a 32bit only IDE, the component installer will generate & install these 6 packages as 32bit packages. You can not install a package compiled in 64bit mode in the IDE as the IDE is stricly 32bit! A design-time package can also not be compiled for 64bit as it has a dependency on design time IDE packages that are only available for 32bit.
The IDE takes in account though what components are available for 32bit or 64bit application development. This means that a component that is not explicitely marked for 64bit will not appear on the component palette when the 64bit target is selected. The components in the TMS VCL UI Pack are all marked for both 32bit and 64bit target, so should appear on the component palette regardless of the application target selected.
Delphi32bit and 64bit application development with Delphi is easy and straightforward. When you switch the target in your application between 32bit and 64bit, the compiler will compile the application code and also the component code for the selected target. The generated executable will be either a 32bit or 64 bit executable and thus the components in the application will run either in 32bit or 64bit code.
Some attention is required when runtime packages are used! In this case, it is required that a 32bit application will be shipped with the 32bit version of the used TMS VCL UI Pack package and a 64bit application will be shipped with the 64bit version of the used TMS VCL UI Pack package. So, for 64bit applications using runtime packages, make sure the packages TMSDXE*.DPROJ, TMSEXDXE*.DPROJ, TMSXLSDXE*.DPROJ have been compiled for the 64bit target. The IDE generates these compiled packages (.BPL files) by default under $(BDSCOMMONDIR)\Bpl\$(Platform) or translated for a default IDE install under: C:\Users\Public\Documents\RAD Studio\*.0\Bpl\Win64 (* = 10 for XE3, 11 for XE4, 12 for XE5)
C++BuilderFor C++Builder, the selection of the target for the application in the IDE is similar. The TMS VCL UI Pack components are also for the C++Builder personality registered for the 32bit application tool palette as for the 64bit application tool palette. An important difference is that the component HPP files needed for 32bit applications are different from component HPP files for 64bit applications. The same applies for the linked. The 32bit linker needs the library files TMSDXE*.LIB, TMSEXDXE*.LIB, TMSXLSDXE*.LIB while the 64bit linker needs TMSDXE*.a, TMSEXDXE*.a, TMSXLSDXE*.a. The TMS VCL UI Pack installer did not compile automatically for 64bit so it is mandatory to perform this compilation of the packages TMSDXE*.DPROJ, TMSEXDXE*.DPROJ, TMSXLSDXE*.DPROJ to 64bit target as this will generate the required 64bit HPP files and 64bit .A files.
C++Builder in RAD Studio
When RAD Studio is installed, the Delphi packages TMSDXE*.DPROJ, TMSEXDXE*.DPROJ, TMSXLSDXE*.DPROJ can be easily opened from the RAD Studio IDE, the 64bit target can be selected and the packages can be compiled. This will generate the relevant & needed 64bit support files for compiling 64bit C++Builder applications (i.e. the HPP files and the .A files). Make sure that the include path settings of the application are properly setup to use the 32bit HPP files when compiling the application to the 32bit target and to use the 64bit HPP files when compiling the application to the 64bit target. Just like with Delphi, it is important that when compiling with runtime packages, that you distribute the 32bit runtime package with a 32bit executable and the 64bit runtime package with a 64bit executable.
When only the C++Builder personality is installed, it is not possible to open the Delphi packages files from the IDE, hence, it is not possible to compile the packages for 64bit from the IDE. In this case, the MSBUILD tool can be used. A general overview of the use of MSBUILD can be found here: http://docwiki.embarcadero.com/RADStudio/XE5/en/MSBuild_Overview.
To use MSBUILD to compile the packages TMSDXE*.DPROJ, TMSEXDXE*.DPROJ, TMSXLSDXE*.DPROJ for 64bit, open a command prompt and first call the proper RSVARS.BAT file to set the needed environment variables for using MSBUILD. RSVARS.BAT is installed in the folder C:\Program Files (x86)\Embarcadero\RAD Studio\*.0\bin.
After RSVARS was called, the environment variables were set and MSBUILD is ready to be used. Using following commands to compile the TMS VCL UI Pack packages files for 64bit:
MSBUILD /p:platform=Win64 TMSDXE*.DPROJ MSBUILD /p:platform=Win64 TMSEXDXE*.DPROJ MSBUILD /p:platform=Win64 TMSXLSDXE*.DPROJThis will generate both the 64bit .HPP files the C++ 64bit application needs to compile with and the 64bit .A files the C++ 64bit application needs to link with.