1

我是在 C++ 中创建 DLL 库的新手,这是我的代码

//header.h
class A
{
  virtual int  funct()=0;  //Pure virtual function 
};

项目 B(在编译时生成 DLL)

#include "header.h"
#define B_DLL __declspec( dllexport )
class B_DLL B: public A
{
  //Definitions of the 3 pure virtual functions are here
  int funct() 
  {
    //definition go here
  }

};

现在我创建一个类 A 的实例并调用funct()然后我收到错误

Run-Time Check Failure #0 - The value of ESP was not properly saved across a
function call.  This is usually a result of calling a function declared with
one calling convention with a function pointer declared with a different calling
convention.

如何使用调用约定_cdecl_stdcall来解决这个问题。我搜索了很多但找不到确切的解决方法请帮助我解决这个问题

提前致谢

4

1 回答 1

0

A是一个纯粹的抽象类(接口),你不能初始化一个抽象类,也不能直接使用它的方法。您应该改为初始化它的导数B_DLL

于 2013-07-05T06:18:09.107 回答