当运行带有DLL的应用程序时,不会安装FastMM

时间:2018-11-15 19:58:31

标签: c++builder fastmm

我将Windows 10与C ++ Builder XE4和FastMM 4.991一起使用。我正在使用32位VCL应用程序。当我的应用程序包含对DLL函数的调用时,我收到一条错误消息,提示无法安装FastMM。 FastMM在不包含调用任何DLL函数的应用程序中正常工作。

我的DLL被创建为C ++ VCL Dll。我尝试使用FastMM组件编译DLL,并设置了FastMM选项“ ShareMM”和“ AttemptToUseShareMM”。我宁愿不在DLL中编译FastMM,因为我只对调试主exe感兴趣。

下面是我的主窗体中的代码,其中有一个简单的DLL函数调用。我必须设置DLL错误或FastMM选项错误。在Delphi或C ++ Builder中,是否有使用FastMM正确获取DLL设置的说明?

//------------------------
#include <vcl.h>
#pragma hdrstop

#include "MyUnit1.h"
#include "FastMM4.hpp"
#include "FastMM4Messages.hpp"

#define DLL_EXP __declspec(dllexport)

extern short DLL_EXP IsDateRangeValid( int Date );

//---------------------------
#pragma package(smart_init)
#pragma link "FastMM4BCB"
#pragma resource "*.dfm"
TMainForm1 *MainForm1;
//----------------------------------
__fastcall TMainForm1::TMainForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//--------------------------

void __fastcall TMainForm1::Button1Click(TObject *Sender)
{
  short Rtrn=0;
  int MyDate=0;

  //Call to a DLL function block FastMM from Loading
  Rtrn = IsDateRangeValid( MyDate ); //<---
  ShowMessage(IntToStr(Rtrn));
}
//------------------------------------

// --- FastMM错误消息---

FastMM4无法安装,因为已经安装了另一个第三方内存管理器。如果要使用FastMM4,请确保PastMM4.pas是项目的.dpr文件的“用户”部分中的第一单元。

0 个答案:

没有答案