简体   繁体   English

Visual Studio中的调用约定

[英]Calling Conventions in Visual Studio

I have a fortran DLL built in the CVF convention and my c++ code built using cdecl calling convention to get the stuff it needs from my DLL. 我有一个基于CVF约定的fortran DLL,并且我的c ++代码是使用cdecl调用约定构建的,以从DLL中获取所需的内容。 I checked in my c++ code obj files and the symbols are '_ imp _variable'. 我签入了我的c ++代码obj文件,符号为'_ imp _variable'。 Then in my fortran dll the symbol shows up as 'variable'. 然后在我的fortran dll中,该符号显示为“变量”。 I got some linker errors (unresolved external symbol _ imp _variable), is it because c++ is looking for '_ imp _variable' exactly as is in my DLL? 我遇到了一些链接器错误(无法解析的外部符号_ imp _variable),是因为C ++正在完全像我的DLL一样在寻找“ _ imp _variable”吗? Or does VS cdecl calling convention just adds stuff weirdly but it knows to look for 'variable'? 还是VS cdecl调用约定只是奇怪地添加了一些东西,但它知道要查找“变量”?

Prefix __imp__ is added by __declspec(dllimport) storage-class attribute. 前缀__imp____declspec(dllimport)存储类属性添加。 It means that object or function is imported from DLL using import library (usually created by linker on DLL build). 这意味着使用导入库(通常由DLL构建中的链接器创建)从DLL导入对象或函数。 Make sure you added such library to your project. 确保已将此类库添加到项目中。

If for unknown reason you don't have import lib or DLL sources take a look here: http://support.microsoft.com/kb/131313 如果由于未知原因您没有导入lib或DLL源,请在此处查看: http : //support.microsoft.com/kb/131313

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM