问一个简单的函数定义问题?

gstone 2002-05-09 02:25:24
有这样一个函数
void __declspec(dllexport) fun0(int n)
我想问一下,__declspec(dllexport) 这些东西是自己写的,还是VC++开发环境自动生成的。如果是自动的,怎么弄出来!

谢谢!!!
...全文
53 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
bitsoft 2002-05-09
  • 打赏
  • 举报
回复
在.def文件中的EXPORTS下写:
EXPORTS
; Explicit exports can go here
fun0

否则dll输出的并不是你所期望的fun0

slimak 2002-05-09
  • 打赏
  • 举报
回复
1.用VC自带的工具:Depends(在开始菜单->VC那一堆菜单项目里面有)看看你编译的DLL里面是否有你要调用的函数.
2.看看是不是你的DLL位置放的不对导致找不到DLL.
3.是不是你的DLL的.lib文件不匹配.
gstone 2002-05-09
  • 打赏
  • 举报
回复
那我为什么写了一个,编译成dll后,在另一个dll里调用就说找不到方法,可别人的例子就好用。
我基本上是全拷下来的!
xuying 2002-05-09
  • 打赏
  • 举报
回复
自己写就可以。加上这个你就可以把这个函数作为dll的输出函数了。

The dllexport and dllimport storage-class attributes are Microsoft-specific extensions to the C and C++ languages. They enable you to export and import functions, data, and objects to and from a DLL. These attributes explicitly define the DLL’s interface to its client, which can be the executable file or another DLL. Declaring functions as dllexport eliminates the need for a module-definition (.DEF) file, at least with respect to the specification of exported functions. Note that dllexport replaces the __export keyword.

The declaration of dllexport and dllimport uses extended attribute syntax.

LocalVar 2002-05-09
  • 打赏
  • 举报
回复
你可以自己写,在msdn的索引中输入__declspec等就可以查到有哪些东西时刻用的。__declspec(dllexport)的意思是输出这个函数

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧