明明导出的函数,无法导入

来源:互联网 发布:数据流量dns劫持 编辑:程序博客网 时间:2024/05/04 16:52


导出时是:__imp_?Utf82Unicode@@YA?AV?$basic_string@GU
导入时是:__imp_?Utf82Unicode@@YA?AV?$basic_string@_WU
G和_W的区别,为了研究各字母的含义。做了如下实验:

void fun()=>
?fun@@YAXXZ

void fun(int)=>
?fun@@YAXH@Z

void fun(int a,int b)=>
?fun@@YAXHH@Z

void fun(int a,int b,int c)
?fun@@YAXHHH@Z

void* fun()=>
?fun@@YAPAXXZ

void** fun()==>
?fun@@YAPAPAXXZ

void fun(short * )
?fun@@YAXPAF@Z

short* fun(short * )
?fun@@YAPAFPAF@Z

int fun(bool,char,short int,long,float,double )
?fun@@YAH_NDFJMN@Z

int fun(bool,char,short int,long,float )
?fun@@YAH_NDFJM@Z

int fun(bool,char,short int,long)=>
?fun@@YAH_NDFJ@Z

int fun(bool,char,short int )=>
?fun@@YAH_NDF@Z

int fun(bool,char)=>
?fun@@YAH_ND@Z

int fun(bool )=>
?fun@@YAH_N@Z

int fun(bool a)=>
?fun@@YAH_N@Z

int fun(CString)=>
?fun@@YAHV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z
typedef ATL::CStringT< TCHAR, StrTraitMFC< TCHAR > > CString;

int fun(char)=>
?fun@@YAHD@Z

int fun(wchar_t)
?fun@@YAHG@Z

int fun(CArray<int,int>);
?fun@@YAHV?$CArray@HH@@@Z

int fun(CTime)
?fun@@YAHVCTime@ATL@@@Z

class CTestClass
{
};
_BMFGLOBE_EXPIMP int fun(class CTestClass);
?fun@@YAHVCTestClass@@@Z

int fun(unsigned char,unsigned int,unsigned long)
?fun@@YAHEIK@Z

int fun(__int64)
?fun@@YAH_J@Z

int fun(unsigned __int64 )
?fun@@YAH_K@Z

总结:
1,形参有没有名字,不影响导出。
2,int->H X->void void* ->PAX void**->PAPAX short->F short*->PAF
   bool->N char->D long->J float->M double->N
   CTime->VCTime@ATL CArray<int,int>->V?$CArray@HH
   wchar_t非内置类型(unsigned short)->G wchar_t内置类型->_W unsigned char->E ,unsigned int->I,unsigned long->K
   unsigned __int64->_K __int64->_J
注意:
dll导出的函数可以用VC自带的depend.exe查看。
lib导出的函数可以用命令查看:
dumpbin /LINKERMEMBER  d:\Globe.lib > d:\1.txt
dumpbin是VC自动工具
开发环境:VS2002(VC7)

最后解决方法:
新加的dll 配置弄成和其他dll一样。

 

VS2005的规律见:

http://blog.csdn.net/he_zhidan/article/details/51692783

1 0
原创粉丝点击