c++c++builderfastmm

How to add FastMM to a C++ Builder project?


I'm trying to configure FASTMM4 for Builder C++ 6 and the steps I followed are;

  1. Downloaded zip from sourceforge.
  2. Under the Project -> Options -> Linker menu I unchecked "Use Dynamic RTL".
  3. Unzipped the contents at C:/tools/FASTMM and added FASTMM4.pas file to my test C++ VCL project.
  4. Simply compiled the unit from Project menu and got a new FastMM4.hpp file in FastMM folder.
  5. Included FastMM4BCB.cpp file in my project and also wrote #include <FASTMM4.hpp> on the top.
  6. Added path to FastMM_FullDebugMode.dll and FastMM_FullDebugMode.lib and moved FastMM_FullDebugMode.dll to the Bin folder in Builder C++ install directory.
  7. Enabled the line {$define FullDebugMode} from FastMM4Options.inc.

Did I miss anything? why do I have the following errors?

LINKER ERRORS


Solution

  • I found the instructions in FastMM4BCB file itself and I got it working.

    Usage:

    1. Copy FastMM4BCB.cpp, FastMM4.pas, FastMM4Message.pas, FastMM4Options.inc, and FastMM_FullDebugMode.lib to your source folder.
    2. Copy FastMM_FullDebugMode.dll to your application's .exe directory (if you intend to use FullDebugMode).
    3. To your project, add FastMM4Messages.pas first, then FastMM4.pas, then FastMM4BCB.cpp. On compiling the .pas files, .hpp files are created and imported by the subsequent files.
    4. Add USEOBJ("FastMM4BCB.cpp") to your project file, BEFORE any other USEFORM directives.
    5. Under the Project -> Options -> Linker menu uncheck "Use Dynamic RTL" (sorry, won't work with the RTL DLL).

      FastMM will now install itself on startup and replace the RTL memory manager.