LabVIEWwilliam hill官网
直播中

MING

6年用户 4经验值
擅长:嵌入式技术 RF/无线
私信 关注
[问答]

Labview调用的DLL中加载另一个dll失败

各位好!

请教一下! 我在VC中创建了A.dll,并且在其中动态调用了B.dll。在VC中通过测试程序进行验证,测试程序是静态调用的A.dll,其中使用的A.dll中的initFunc()函数通过LoadLibrary(L"B.dll")加载B.dll,确认可以正常工作后,将其移植到labview中。

结果LabView在执行initFunc()加载“B.dll”时始终失败,提示原因“The specified module couldnot be found(error 126)”。我尝试将B.dll文件路径加到VI Search Path中,将其与A.dll放在同一路径,甚至将其放在/windows/system32路径下,问题始终存在。

请各位帮忙看看为什么始终找不到B.dll文件, 应该如何解决?谢谢!

-----------------------------------------------------------------------
PS:
1. A.dll代码片段如下所示:
-----------------------------------------------------
hwinIoDll= LoadLibrary(L"B.dll");
returnGetLastError();  // debug information to find the error code.
-----------------------------------------------------  

2. 测试程序如下所示 (VC中成功执行)
---------------------------------------------------
intmain()
{
    int ret_val = 0;
   

    ret_val = initFunc();   /* The initial function of A.dll, it will execute LoadLibrary(L"B.dll").*/


    if (ret_val == 0)
    {
        cout << "Load successfully!"<< endl;
    }
    else
    {
        cout << "Load failed, error id is:"<< ret_val << endl;
    }
   



    .....
}
---------------------------------------------------
3.将initFunc()移植到LabView中,如图所示 (加载B.dll始终失败)






  • temp.jpg

回帖(1)

jinyi7016

2018-7-16 14:37:02
常一下路径是不是设置正常的
举报

更多回帖

发帖
×
20
完善资料,
赚取积分