This blog post contains both a fix for compiling kbmMemTable in pure C++Builder personality in newer C++Builder versions (10.x.x – tested with 10.3.3), and a showstopper bug in the IDE when opening it with C++Builder only personality, and compiling kbmMemTable Runtime package in C++Builder 10.3.3 (no Delphi personality) for Win64.

Preface

Because of the growing complexity of compiling packages in C++Builder, I have only occationally updated the C++Builder only projects for kbmMW and kbmMemTable, and instead realied on the Delphi personality, which I always recommend people to also have when using C++Builder, simply because C++Builder is a “bastard” compared to Delphi which is the true 1.st citizen compiler in the IDE. It just simplifies many things, also when being a C++ only developer to have the Delphi personality included.

This has worked out seemingly quite well for several years, either indicating that most that do code using C++Builder, have bought RAD studio including the Delphi personality, or indicating that only very few are actually using C++Builder with kbmMemTable.

However recently a kbmMemTable user contacted me. He had difficulties getting kbmMemTable compiled and installed in his C++Builder only environment.

After some mails forth and back, it seems that we have found a solution for the issues he encounters during compilation. It is those solutions I will describe in this blogpost.

The kbmMemTable project issue

The kbmMemTable installer comes with a C++Builder Seattle project file. To use it in C++Builder 10.3.3 (and probably 10.3.x) do the following:

  1. Open the runtime package in the IDE and save it as kbmMemRunC103Std.
  2. Open the designtime package in the IDE and save it as kbmMemDesC103Std.
  3. Close the package files.
  4. Open kbmMemDesC103Std.cbproj in notepad.exe or similar editor.
  5. Locate and delete the line <OutputExt>.dll</OutputExt>
  6. Save the file and close the editor.
  7. Open kbmMemRunC103Std in the IDE… Build.
  8. Open kbmMemDesC103Std in the IDE… Build….Install
Now you should have a nicely installed kbmMemTable instance in your C++Builder only personality.
Providing you setup your source paths/library paths correctly, you can easily compile your C++ only projects containing kbmMemTable.
This leads us to the next issue.

Compiling kbmMemTable runtime package for Win64

The C++Builder IDE 64 bit compilation showstopper

The first step to make, is adding the Windows 64 bit target to the package. It will go fine.
  1. Open the kbmMemRunC103Std package in the IDE. Add the Win64 target.

    Usually you would then just build the package and be happy. Unfortunately doing that, crashes the IDE without warning after a short while. Debugging into it, it seems to be at a place where the IDE is attempting to collect the number of lines compiled. It actually ends up having generated all headerfiles, and object files, but not the final .a (archive) file.

    The workaround is to compile from the command line.

  2. Start RAD Studio Command Prompt:

  3. In the Cmd.exe like window, type:

    msbuild kbmMemRunC103Std.cbproj /t:Build /p:config=Debug /p:platform=Win64

Now everything will compile correctly and the .a file will be available for later linking when you compile your 64 bit application.

 

 19,651 total views,  2 views today

3 thoughts on “C++Builder revelations #1 – Compiling kbmMemTable – IDE crash when compiling in Win64”
  1. I tried to compile this project using the guidelines provided for the 74 bit but get the linker error unresolved external ‘vtable for Kbmmemtable::TkbmMemTable’

  2. I have just spend time (too much) on setting C++Builder 10.4.2 up to compile kbmMemTable for Win64 and link a simple project with it. As long as one is following the instructions in the blog, and makes sure to setup your own project to compile and link with the appropriate settings (matching paths, target compiler etc. and matching compilation for using runtime libraries or not), then it will link.

    C++Builder is however a PITA to work with IMO. Not because of C++Builder in itself, but because as a C++ developer you have to extremely careful about referencing the correct paths and files, and since there are so many of them, there is a real chance of referencing wrong ones.

    I only recommend using C++Builder if you really have no other choice, because you would be so much more productive using Delphi.

    The complete simple project can be downloaded from here (I used kbmMemTable Pro in this case, but replacing the text Pro with Std at relevant places within the project files, it will work as well with kbmMemTable Standard Edition).

    https://drive.google.com/file/d/1OoxGNyRx3evnyNqf_3E2BXKnChwE1UsO/view?usp=sharing

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.