DLL导出,修饰功能 [英] DLL export, decorated function

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

问题描述

你好,


我正在研究一个小DLL,它将用作

工作应用程序的扩展。要求DLL只有一个名为

" C16_DLLCALL"的导出。所以我开始在Visual C ++ 2008中使用Win32

应用程序向导为DLL创建一个DLL,并对其进行了更改,以便它适用于我们的

应用程序。

但是当我构建DLL文件并使用dumpbin.exe / exports查看它时,导出的函数并不完全称为C16_DLLCALL。根据

函数声明,我得到以下出口名称之一:


?C16_DLLCALL @@ YAHPAUvC16_CCB @@@ Z =?C16_DLLCALL @@ YAHPAUvC16_CCB @ @@ Z(int

__cdecl C16_DLLCALL(struct vC16_CCB *))

使用时:__ declspec(dllexport)[...]


C16_DLLCALL = _C16_DLLCALL

使用时:extern" C" __declspec(dllexport)[...]

我有一个来自应用程序开发人员的示例DLL,当我使用dumpbin查看

时,它确切地说具有所需的名称,没有相同的标志或

其他字符,只是简单的C16_DLLCALL - 在这种情况下,

应用程序在dll中找到入口点。但是对于任何我的

DLL,它都会失败。

如何在不改变导出名称的情况下导出函数?


谢谢,

Patrick Westerhoff

Hello,

I''m currently working on a small DLL that will be used as an extension to a
working application. It is required that the DLL has only one export named
"C16_DLLCALL". So I started creating a DLL in Visual C++ 2008 using the Win32
application wizard for DLLs and changed it so it would work for our
application.
However when I build the DLL file and look at it using dumpbin.exe /exports,
the exported function is not exactly called "C16_DLLCALL". Depending on the
function declaration I get one of the following export names:

?C16_DLLCALL@@YAHPAUvC16_CCB@@@Z = ?C16_DLLCALL@@YAHPAUvC16_CCB@@@Z (int
__cdecl C16_DLLCALL(struct vC16_CCB *))
when using: __declspec(dllexport) [...]

C16_DLLCALL = _C16_DLLCALL
when using: extern "C" __declspec(dllexport) [...]

I have got a example DLL from the application developers and when I look at
it using dumpbin, it exactly has the required name, without equally signs or
other characters, just a plain "C16_DLLCALL" - and in that case the
application finds the entry point within the dll. However with any of my
DLLs, it fails.
How can I export the function without having its export name changed at all?

Thank you,
Patrick Westerhoff

推荐答案

嗨帕特里克,
Hi Patrick,

...我希望有一个名为C16_DLLCALL的出口。

...但我得到......

C16_DLLCALL = _C16_DLLCALL

使用时:extern" C" __declspec(dllexport)[...]
... I like to have one export named "C16_DLLCALL".
... but I get ...
C16_DLLCALL = _C16_DLLCALL
when using: extern "C" __declspec(dllexport) [...]



在项目中添加一个def文件

http://msdn.microsoft.com/en-us/libr...sh (VS.80).aspx


-

SvenC

Add a def file to your project

http://msdn.microsoft.com/en-us/libr...sh(VS.80).aspx

--
SvenC


你好SvenC,


谢谢你的回答。我现在尝试了但收到了以下

出口:


C16_DDLCALL =?C16_DLLCALL @@ CAHPAUvC16_CCB @@@ Z(int __cdecl

C16_DLLCALL(struct vC16_CCB *))

仅使用.def文件时函数中没有任何其他内容

声明

和<当使用.def和externC时,
C16_DDLCALL = _C16_DDLCALL

__declspec(dllexport)


两个都不在申请中工作:(


Patrick Westerhoff


" SvenC"写道:
Hi SvenC,

thank you for your answer. I tried that now but received the following
exports:

C16_DDLCALL = ?C16_DLLCALL@@CAHPAUvC16_CCB@@@Z (int __cdecl
C16_DLLCALL(struct vC16_CCB *))
when using only the .def file without any additional things in the function
declaration
and
C16_DDLCALL = _C16_DDLCALL
when using the .def with extern "C" __declspec(dllexport)

both don''t work in the application :(

Patrick Westerhoff

"SvenC" wrote:

嗨Patrick,


为你的项目添加一个def文件

http:// msdn.microsoft.com/en-us/libr...sh(VS.80).aspx


-

SvenC
Hi Patrick,

Add a def file to your project

http://msdn.microsoft.com/en-us/libr...sh(VS.80).aspx

--
SvenC


嗨帕特里克,
Hi Patrick,

谢谢你的回答。我现在尝试了但收到了以下

出口
thank you for your answer. I tried that now but received the following
exports



重读文章并找到:

"如果你*不使用* __declspec(dllexport)要导出的关键字

DLL的函数,DLL需要.def文件。


相反,你应该指定调用公约明确地在你的

heade中r这样你就不依赖于vc项目默认值了。


externC __stdcall C16_DDLCALL(struct vC16_CCB *);

-

SvenC

Reread the article and find:
"If you are *not using* the __declspec(dllexport) keyword to export
the DLL''s functions, the DLL requires a .def file."

Instead you should specify the calling convention explicitly in your
header so that you do not depend on vc project defaults.

extern "C" __stdcall C16_DDLCALL(struct vC16_CCB *);
--
SvenC


这篇关于DLL导出,修饰功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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