Can't use.dll library on the 2020 or later versions of Matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm working with some DLL library in order to integrate a measurment instrument (a power meeter) on Matlab. I'm using the 2021 version of Matlab and I used the following code to load the DLL library: (note that the library was given to me from the company who sell me the power meeter).
clear all;
%Load the library
NET.addAssembly('C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Thorlabs.TLPM_64.Interop.dll');
import Thorlabs.TLPM_64.Interop.*;
%Create a dummy TLPM object to check for compatible devices.
handle = System.IntPtr(0);
device = TLPM(handle);
%Search the device
[~,deviceCount] = device.findRsrc();
When I run it, Matlab load the library but when I try to use the function "findRsrc" I get the following error:
Found on line 1324 of input from line 1065 of file C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Include\\TLPM.h
Type 'intViStatus__fastcall' was not found. Defaulting to type error.
Found on line 1325 of input from line 1066 of file C:\\Program Files\\IVI Foundation\\VISA\\Win64\\Include\\TLPM.h
Warning no reference to header 'C:/Program Files/IVI Foundation/VISA/Win64/Include/visa' added with addheader was found in source.
*********
Error using loadlibrary
Building TPLM_64_thunk_pcwin64 failed. Compiler output is:
cl -I"C:\Program Files\IVI Foundation\VISA\Win64\Lib_x64\msc" -I"C:\Program Files\IVI Foundation\VISA\Win64\Include" -I"C:\Program
Files\MATLAB\R2020a\extern\include" /Zp8 /W3 /nologo -I"C:\Users\install\Desktop" -I"C:\Program Files\IVI Foundation\VISA\Win64\Include"
"TPLM_64_thunk_pcwin64.c" -LD -Fe"TPLM_64_thunk_pcwin64.dll"
TPLM_64_thunk_pcwin64.c
TPLM_64_thunk_pcwin64.c(47): error C2059: syntax error: '*'
I tried many things ans then, by seraching online, I saw that the problem is may due to the compiler version. Since I have also 2019 and 2020 matlab licenes I tried on both the version and i found out that it works on the 2019 version of Matlab.
So my questions is: Do you have any ideaa what could be the problem on the newest version? there is something that I can do to make it work on the 2020/2021 version?
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Acquisition Toolbox Supported Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!