New in RAD Studio 10.2.1: CodeGuard for Windows 8 and 10

Posted by on in Blogs

CodeGuard is a tool for runtime error checking in a C++ application, and catches memory leaks, invalid handles, invalid memory use (such as writing past the end of a buffer), pointer validation, accessing freed memory and resources, and more. If you've never used it, check out the list of runtime errors it will find, and potential memory access problems it will warn you about.

An app needs to be specially built to enable CodeGuard instrumentation, and Windows 8 and 10 made a number of changes that prevented CodeGuard from working on those OSes.  As of C++Builder 10.2.1, CodeGuard is enabled for Windows 8 and 10.

Many users find CodeGuard a great addition to their toolbox for for runtime debugging, and we hope you'll be happy to see the feature on Windows 10!

How do I use CodeGuard?

To enable CodeGuard, navigate to the Tools menu, CodeGuard Configuration, and check the "Enable" checkbox. This turns the feature on as a whole. A project needs to be specially built to support CodeGuard, so open your project options, and in C++ Compiler > Debugging ensure "Enable CodeGuard" is checked. Generally, you will want to do this in a debug build only.

Errors will show either in the Messages docked window's CodeGuard tab, or as a dialog box, depending on the error. 

CodeGuard is for the classic Win32 compiler only. (Similar features for the Clang series of compilers are under consideration.)


Gold User, No rank,
C++ Product Manager, looking after C++Builder as well as the IDE.


  • Abdelali D59836
    Abdelali D59836 Thursday, 15 March 2018

    Hi David,
    I found that the reason is that my project (DLL project) links with cp32mti.lib
    Since I removed this lib, codeguard was able to start normally.
    Is there another multithread Library I can use ?

  • David Millington
    David Millington Thursday, 15 March 2018

    Interesting... can you check to make sure it's the right version, ie it's not linking against 10.1's or similar? Otherwise, please file a QP report, best with a sample that shows it, and feel free to email me the number too. (firstname dot lastname at

  • Abdelali D59836
    Abdelali D59836 Thursday, 15 March 2018

    Sure, the project was linking fine with cp32mti.lib on Berlin 10.1 and win7. Codeguard also was working fine.
    Since passing to Tokyo 10.2.2 and win10, the error "non shared data segment" occured. and it is fixed by removing this lib. I'll try to create a qp report with a little sample asap.

  • David Millington
    David Millington Monday, 19 March 2018

    Thankyou! Please do, and feel free to email me with the QP report number so I can get it looked into ASAP.

  • Abdelali D59836
    Abdelali D59836 Thursday, 1 March 2018

    I have issue using codegaurd with Rad Studio 10.2.2 on win10.
    I have an error "non shared segment data" when codeguard is enabled
    Someone can help me ?

  • David Millington
    David Millington Wednesday, 14 March 2018

    There are some suggestions at the end of this forum thread: (removing the -dc flag, turning on packages and dynamic RTL). Otherwise, please file a support request or a bug report, ideally with a sample project showing the issue.

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: