Connecting to an MS Access Database from a Windows 64 bit VCL Application.

There is documentation about how to create VCL windows 64 bit application that uses FireDAC to connect to a database based on MS Access.

I have had to do this to convert a legacy MS Access based system to a system fit for future development (actually based in my case on PostgreSQL). There is documentation on how to do this at the following link:

How to connect to MS Access from Win 64

But as well as following the steps in this documentation there is on key tip that is easily overlooked: you must NOT have a FDPhysMSAccessDriverLink (non-visual) component on any form in your application.

RAD Studio 11 now has TwineCompile!

Embarcadero have now released RAD Studio 11, to some good feedback.

For C++ users there is an anticipated delay between the product release and the availability of a compatible version of TwineCompile in the Gettit package manager. Without this tool C++ projects compile 100% OK but take a long time to build. TwineCompile allows compilations to run in parallel and changes use of C++ from being a drawn out process to being a delight!

TwineCompile (version 5.3) is now in Gettit ! – so go get it !

There is an announcement about the new features in TwineComile here

Embarcadero RAD Studio 11 is Now Available!

Embarcadero have now officially released the latest version of their IDE: RAD Studio 11 Alexandria promises a great new high DPI experience.

You can start a free trial download at

I will be mentioning some of the benefits of upgrading for C++ users in the coming weeks.

RAD Studio 11 is Coming!

Embarcadero have announced that RAD Studio 11 is coming. Looking at the beta referred to in the link below it is clear that there are some good things to be expected in this new release.

Free Learn To Code Week – Great for Students

If you want a chance to learn to code (or maybe pick up ideas about how to teach coding?) maybe this “Embarcadero Coding Summer Camp” which officially started yesterday is for you…..

Tips For Using GoogleTests with Embarcadero Clang64 for Windows VCL Projects.

In my previous posting I covered how to install GoogleTests framework ready for use with Embarcadero C++. Now I am going to offer some advice on how to write simple tests for your own VCL projects using the GoogleTests framework framework. I will assume Clang64 but it all applies equally to Clang32 projects.

If you try to use the GoogleTests files where they were installed you end up with very long include paths and you also lose your project independance. It seems much more convenient to create a copy of the key files in a directory local to your project. I suugest:

  1. Create a directory in your project called “GoogleTest”
  2. Inside “GoogleTest create a directory “LibWin64”
  3. Inside “LibWin64” copy the four files gmock.a, gmock_main.a, gtest.a and gtest_main.a (only gtest.a is actually required to run simple tests) from the lib folder C:\Users\ [ your account name ] \Documents\Embarcadero\Studio\21.0\CatalogRepository\GoogleTest-2021.03\cbuilder\lib\Win64\Release.
  4. Inside “GoogleTest create a directory “Include”
  5. Inside “Include” copy the directory “gtest” from C:\Users\ [ your account name ] \Documents\Embarcadero\Studio\21.0\CatalogRepository\GoogleTest-2021.03\googletest\include\gtest, making sure you include the “Internal” folder and all it’s contents (including further sub-directories).
  6. In your project group create a new windows64 bit VCL console application. As well as the files you want to test and the files containing the testing code you need to add to the project the library file …GoogleTest\LibWin64.
  7. In your project options add the include path ….GoogleTest\Include\gtest.

Having configured your project in this way you then need to add the line “#include “gtest.h” at the begining of each of your *.cpp files that you generate to test your project (convention suggests one test file for each *.cpp unit in your main project). In addition, in your main VCL console cpp file, you need to change the “main()” program entry point so that it becomes:

int _tmain(int argc, _TCHAR* argv[])
  printf("Running main() from %s\n", __FILE__);
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();

One key point to be aware of is that you must build your test project (you still choose which ever setting you want for projects you ship) using dynamic run time linking of packages set to true. Set this in project | options | C++ Linker.

Using GoogleTests with Embarcadero Clang64 for Windows VCL Projects

The old C++ Builder “classic” win32 compiler worked well with the associated DUnit framework for unit testing.

With the clang compilers (both clang32 and clang64) there are issues when using the DUnit framework. It makes sense to use a framework that is up to date and receiving on going support. Such a framework is GoogleTests.

There are two stages to using GoogleTests with your own Windows clang64 C++ project.

Firstly you have to download it, install it and confirm that all is well. After doing that you have to work out how to use it with your own project.

Downloading is easy if you have C++ Builder 10.4.2 as GoogleTests appears in the Getit package manager. Using Getit the test framework along with sample programs can be automatically downloaded and installed.

The resultant files are stored in

C:\Users\[your account name here] \Documents\Embarcadero\Studio\21.0\CatalogRepository\GoogleTest-2021.03

We will call this long path ”…GT2021.03” for the rest of this blog.

Now build and run the files as follows.

Using the C++ Builder IDE, open the project group GoogleTest.groupproj in …GT2021.03\cbuilder
You can now build all the projects (they are set for clang32). But for our discussion we need it to run with clang64. Edit each of the project settings for each of the projects in the project group so that each project uses clang64.

Now do a build all projects to build everything using clang64.

The exe file resulting from the sample8_unittest.cbproj is file sample8_unittest.exe in directory …GT2021.03\cbuilder\bin\Win64\Release

Open a DOS command line shell in this directory and then run sample8_unittest.exe. You will see that it reports 12 test passes.

Great ! You’ve got GoogleTests installed and looking good! In my next blog I will make some suggestions about how to use it with your C++ Builder VCL clang64 project.

More on Order of Events When Creating and Destroying a Form in C++ Builder

The last two blogs have been about Embarcadero C++ Builder events that are fired when a form is created or destroyed.

As an addition to these postings I refer everyone to Remy’s stack overflow comments about the order of events and the fact that it’s good to put constructor stuff in the constructor

(Scroll down to the end of the long list of comments posted on this stack overflow question)

As well as pointing out that in the past (early versions of C++ Builder) there may have been an issue with the event firing order Remy wisely advises that it is always good C++ programming practice to put initialisation code in the constructor. Similarly it’s always advisable to put any close down tidying up code in the destructor.

I completely endorse Remy’s wise words.