我正在尝试调用位于为我们开发的DLL中的函数。当我尝试运行脚本时,向我显示以下错误:Error opening DLL library TESTFUNC.dll for external function at line <line number> in <event name> event of object <object name>
。
外部函数定义:
FUNCTION long FUNCTION1(str_temp istr_temp) LIBRARY "TESTFUNC.dll" alias for "FUNCTION1;Ansi";
函数调用:
ll_i = This.FUNCTION1(istr_temp)
该函数用Visual Basic编写:
static int FUNCTION1(structureTemp* i_structTemp) {
int status;
VeLibCtxParams libCtxArgs = VeLibCtxParamsDefaults;
printf("\nEntering Volt Init");
libCtxArgs.policyURL = i_structTemp->policyUrl;
libCtxArgs.fileCachePath = i_structTemp->storageDirectory;
libCtxArgs.trustStorePath = i_structTemp->trutstoreDirectory;
status = VeCreateLibCtx(&libCtxArgs,
&veLibCtx);
if (SUCCESS != status)
{
printf("Failed VeCreateLibCtx with status <%ld>\n", status);
return(FAILURE);
}
return SUCCESS;
}
不是Visual Basic,看起来像C或C ++。要从PowerBuilder调用C / C ++函数,必须将其声明为__stdcall或WINAPI。