__stdcall(/ Gz)的DLL问题 [英] Dll problem with __stdcall (/Gz)

查看:101
本文介绍了__stdcall(/ Gz)的DLL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个项目,我的项目设置存在问题,并且在没有链接错误的情况下编译dll。我发现,如果我将调用约定放到__stdcall(/ Gz),它会使我的问题库感到高兴(没有链接错误)。然而,这个
使得之前工作正常的不同库有链接错误。 



任何人都可以向我解释为什么这样问题正在发生以及如何让这些图书馆很好地一起玩? 



谢谢。



(我确实正确连接了.h文件和库)。

解决方案

更多信息 - 我正在检查两个库的包含头文件,看起来这些函数的调用方式相同。 


headerA.h


#define _FUNC __declspec(dllimport)


_FUNC  int FuncA(int x);



headerB.h


__ declspec(dllimport)unsigned short FuncB(unsigned long y);



<在我看来,他们都想要_decl调用约定?为什么切换到_stdcall使我的LibA链接错误消失了?这只是巧合吗?是否应该更改为_stdcall真的让我有LibB的链接错误?我无法理解
这里发生了什么。我对dll的知识有限,通常我只是从硬件供应商处接收它们并毫不费力地附加它们。


I am creating a project and am having an issue with my project settings and getting the dll(s) to compile without link errors. I find that if I put the calling convention to __stdcall(/Gz) it makes my problem library happy (no link errors). However this makes a different library that was previously working fine have link errors. 

Can anyone explain to me why this issue is happening and how I can get these libraries to play together nicely? 

Thanks.

(I do have the .h files and libs attached correctly).

解决方案

More information - I am examining the included header files for both libraries and it appears that the functions are called in the same way. 

headerA.h

#define _FUNC __declspec( dllimport )

_FUNC int FuncA( int x);

headerB.h

__declspec(dllimport) unsigned short FuncB(unsigned long y);

It appears to me that they both want the _decl calling convention? Why does switching to _stdcall make my link errors from LibA go away? Is that just a coincidence? And should changing to _stdcall really make me have link errors for LibB? I can't make sense of what is going on here. I have limited knowledge of dll's, usually I just receive them from the hardware vendor and attach them without difficulty.


这篇关于__stdcall(/ Gz)的DLL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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