DLL导出C ++类,约DEF文件的问题 [英] Exporting DLL C++ Class , question about .def file

查看:165
本文介绍了DLL导出C ++类,约DEF文件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的项目中使用隐式链接,并执行nmake真的想.def文件。问题是,这是一类的,我不知道是什么在出口部分编写。
任何人都可以点我在正确的方向?

该错误信息是:

NMAKE:U1073:不知道如何使'DLLCLASS.def

P.S:我试图使用Windows CE平台生成器生成


解决方案

您可以随时使用的 DUMPBIN /符号myclass.obj

在我的情况

  A级{
   上市:
     A(INT){}
};

DUMPBIN 转储显示符号 ?? 0A @@ QAE @ H一般@ Z(众:__thiscall A :: A(INT))

在DEF文件把这个符号会导致链接器创建A ::在出口符号A(INT)符号。

BUT 在他的评论中@paercebal状态:饰(错位)名称的手工录入是件苦差事 - 容易出错,而可悲的是,没有保证的广告必须跨越的编译器版本便携<。 / p>

I want to use implicit linking in my project , and nmake really wants a .def file . The problem is , that this is a class , and I don't know what to write in the exports section . Could anyone point me in the right direction ?

The error message is the following :

NMAKE : U1073: don't know how to make 'DLLCLASS.def'

P.S: I'm trying to build using Windows CE Platform Builder .

解决方案

You can always find the decorated name for the member function by using dumpbin /symbols myclass.obj

in my case

class A {
   public:
     A( int ){}
};

the dumpbin dump showed the symbol ??0A@@QAE@H@Z (public: __thiscall A::A(int))

Putting this symbol in the .def file causes the linker to create the A::A(int) symbol in the export symbols.

BUT! as @paercebal states in his comment: the manual entry of decorated (mangled) names is a chore - error prone, and sadly enough, not guarenteed to be portable across compiler versions.

这篇关于DLL导出C ++类,约DEF文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆