关于网友提出的“ VC调用 vb DLL出错(vb DLL访问了数据库)”问题疑问,本网通过在网上对“ VC调用 vb DLL出错(vb DLL访问了数据库)”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: VC调用 vb DLL出错(vb DLL访问了数据库)描述:
本帖最后由 lys0053 于 2009-07-20 14:56:03 编辑
这是VC代码#import "C:\WINDOWS\system32\RSDLL.dll"no_namespace
#import "C:\WINDOWS\system32\msado15.dll"no_namespace
int _stdcall KMT_start(int devType, char uid[], char fw[], char chip[], int tune, char kmtINI[], long len[])
{
BSTR bstrDesc,str;
// SysFreeString(str);
str=_com_util::ConvertStringToBSTR(str1);
try
{
CoInitialize(NULL);
_Class1Ptr ptr=NULL;
ptr.CreateInstance(__uuidof(Class1));
if(ptr==0)
{
AfxMessageBox("无效的指针");
return 0;
}
ptr->KMT_app_start(&str);
}
catch(_com_error &e)
{
bstrDesc = e.Description();
}
CoUninitialize();
return 0;
}
报错:
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tlh(45) : error C2146: syntax error : missing ';' before identifier 'Cn'
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tlh(45) : error C2501: '_ConnectionPtr' : missing storage-class or type specifiers
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tlh(45) : error C2501: 'Cn' : missing storage-class or type specifiers
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tlh(51) : error C2146: syntax error : missing ';' before identifier 'GetCn'
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tlh(51) : error C2501: '_ConnectionPtr' : missing storage-class or type specifiers
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tli(14) : error C2143: syntax error : missing ';' before 'tag::id'
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tli(14) : error C2433: '_ConnectionPtr' : 'inline' not permitted on data declarations
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tli(14) : error C2501: '_ConnectionPtr' : missing storage-class or type specifiers
e:\program files\microsoft visual studio\myprojects\callvb\debug\rsdll.tli(14) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
CALLVB.dll - 9 error(s), 0 warning(s)