【发布时间】:2011-08-04 14:33:13
【问题描述】:
我有一个程序调用一组函数如下:
int _stdcall VB_Create(char*);
int _stdcall VB_Open(unsigned int, unsigned int, unsigned int, unsigned int);
...
...
如果名称修饰不匹配,链接器会显示如下错误:
error LNK2019: unresolved external symbol "int __stdcall VB_Create(char *)" (?VB_Create@@YGHPAD@Z) .....
我的理解是_stdcall 语法是'_' + 'name of the function' + '@' + 'number of arguments * 4'。
那么,为什么链接器要求?VB_Create@@YGHPAD@Z 名称装饰?这是什么标准?
【问题讨论】:
-
它因编译器而异。你用的是什么编译器?而且该名称不是调用约定标准,它是基本的 C++ 名称修饰,这是编译器将 C++ 方法名称转换为 C 函数名称的方式(在汇编级别没有方法之类的东西)。
标签: c calling-convention name-decoration