09-11-2024 04:29 AM
I have a internal library named A.dll build by VS2019, and I write a VS2019 application to test NIVISA's API and functionality A.dll.
The testing code is pretty simple, psudo code is like:
- Dynamic load visa64.dll
- GetProcAddress of viOpenDefaultRM/viOpen/viClose
- Call viOpenDefaultRM
- Call viOpen
- Call viClose
The flow run well in my environment, but once I load A.dll into project, I got viopen failed, the viopen error is like
Status code: 0xBFFF0011
Status name: VI_ERROR_RSRC_NFOUND
Insufficient location information or the device or resource is not present in the system.
It seems once I load A.dll into program's memory space. It would result in nivisa library's funciton call failed.
And the problem is the the viopen failed issue only happened after NI-VISA 17.5 version, it run pretty well before NI-VISA 17.0 version
Since it looks like an environment issue, I check the dependency walker and try some experiments on my environment and see it it could fix this issue.
Its even weird that once I copy the C:\Windows\System32\msvcp140d.dll and re-name it as msvcp140.dll and put it under the execution folder.
The problem solved under debug library of msvcp140.dll.
Can anyone expalins the difference between NI-VISA 17.0 and NI-VISA 17.5??
Also why I could only run with debug version of msvcp140.dll, is that any conflict in between NI-VISA 17.5 and Visual C++ runtime library (msvcp140.dll) ?
09-12-2024 02:24 AM
Did you compile your A.DLL as debug built?
09-12-2024 05:43 AM
No, my A.dll is release version.
I just rename C:\Windows\System32\msvcp140d.dll as msvcp140.dll and force the whole flow to use debug version of runtime library
I also use ListDll to check the runtime dynamic library dependency while viopen failed:
The whole dependency dll ater run with viopen is like:
C:\windows\SYSTEM32\ntdll.dll
C:\windows\System32\KERNEL32.DLL
C:\windows\System32\KERNELBASE.dll
c:\windows\system32\dgapi64.dll
C:\windows\System32\USER32.dll
C:\windows\System32\win32u.dll
C:\windows\SYSTEM32\OLEACC.dll
C:\windows\SYSTEM32\WTSAPI32.dll
C:\windows\System32\GDI32.dll
C:\windows\System32\ucrtbase.dll
C:\windows\System32\msvcrt.dll
C:\windows\System32\gdi32full.dll
C:\windows\System32\RPCRT4.dll
C:\windows\System32\msvcp_win.dll
C:\windows\System32\ADVAPI32.dll
C:\windows\System32\sechost.dll
C:\windows\System32\SHELL32.dll
C:\windows\System32\ole32.dll
C:\windows\System32\combase.dll
C:\windows\System32\OLEAUT32.dll
C:\windows\System32\SHLWAPI.dll
C:\windows\System32\CRYPT32.dll
C:\windows\SYSTEM32\USERENV.dll
C:\windows\SYSTEM32\VERSION.dll
C:\windows\SYSTEM32\MPR.dll
C:\windows\SYSTEM32\winhafnt64.dll
D:\Code\Project\TestApp\B.dll
C:\windows\SYSTEM32\VISA64.dll
D:\Code\Project\TestApp\A.dll
C:\windows\System32\WS2_32.dll
C:\windows\SYSTEM32\MSVCP140.dll
C:\windows\SYSTEM32\VCRUNTIME140.dll
C:\windows\SYSTEM32\VCRUNTIME140_1.dll
C:\windows\SYSTEM32\visaUtilities.dll
C:\windows\SYSTEM32\visaConfMgr.dll
C:\windows\System32\IMM32.DLL
C:\windows\SYSTEM32\windows.storage.dll
C:\windows\SYSTEM32\Wldp.dll
C:\windows\System32\SHCORE.dll
C:\windows\System32\bcryptPrimitives.dll
C:\windows\SYSTEM32\profapi.dll
C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AE_MailSensor_Plugin64.dll
C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\ame_outlooksensor64.dll
C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\ame_smtpsensor64.dll
C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\OS_Plugin64.dll
C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\COM_Sensor64.dll
C:\windows\SYSTEM32\winhadnt64.dll
C:\windows\SYSTEM32\WINMM.dll
C:\windows\SYSTEM32\dtframe64.dll
C:\windows\SYSTEM32\TIjtDrvd64.dll
C:\windows\SYSTEM32\winspool.drv
C:\windows\SYSTEM32\dtsframe64.dll
C:\windows\SYSTEM32\mswsock.dll
C:\windows\System32\psapi.dll
C:\windows\SYSTEM32\WinUsb.dll
C:\windows\System32\setupapi.dll
C:\windows\System32\cfgmgr32.dll
C:\windows\System32\bcrypt.dll
C:\windows\SYSTEM32\TMailHook64.dll
C:\windows\SYSTEM32\winncap364.dll
C:\windows\SYSTEM32\secur32.dll
C:\windows\SYSTEM32\SSPICLI.DLL
C:\windows\system32\nivisa64.dll
C:\windows\SYSTEM32\NiViSv64.dll
C:\windows\SYSTEM32\NiSpyLog.dll
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiVi488.dll
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiViAsrl.dll
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiViEnet.dll
C:\windows\SYSTEM32\WININET.dll
C:\windows\SYSTEM32\WSOCK32.dll
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiViEnetAsrl.dll
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiViGrpc.dll
C:\windows\SYSTEM32\dbghelp.dll
C:\windows\SYSTEM32\CRYPTBASE.DLL
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiViPxi.dll
C:\windows\SYSTEM32\niqpxi.dll
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiViRpc.dll
C:\windows\SYSTEM32\nirpc.dll
C:\Program Files\IVI Foundation\VISA\Win64\Bin\NiViUsb.dll
C:\Program Files\IVI Foundation\VISA\Win64\NIvisa\PxiPlugins\NiViPpiP.dll
C:\windows\SYSTEM32\nipalu.dll
C:\windows\SYSTEM32\nipalut.dll
C:\Program Files\IVI Foundation\VISA\Win64\NIvisa\PxiPlugins\NiViPpiD.dll
C:\windows\SYSTEM32\kernel.appcore.dll
C:\windows\system32\uxtheme.dll
C:\windows\system32\thooksv364.dll
C:\windows\SYSTEM32\iphlpapi.dll
C:\windows\System32\NSI.dll
C:\windows\SYSTEM32\dhcpcsvc.DLL
C:\windows\system32\napinsp.dll
C:\windows\system32\pnrpnsp.dll
C:\windows\system32\wshbth.dll
C:\windows\system32\NLAapi.dll
C:\windows\SYSTEM32\DNSAPI.dll
C:\windows\System32\winrnr.dll
C:\Program Files\National Instruments\Shared\mDNS Responder\nimdnsNSP.dll
C:\windows\SYSTEM32\nimdnsResponder.dll
C:\Windows\System32\rasadhlp.dll