Compiling a IVI Driver in R2013a

7 views (last 30 days)
I'm having trouble compiling an IVI device driver. I've installed IVI shared components and the instrument driver. Everything works well in the MATLAB environment but I get the following error when running the compiled code:
"The VXIplug&play driver could not connect to the instrument using the specified resource. If this error is not an instrument error, use MIDEDIT to inspect the driver."
handles.rfswitch_tcp_config = icdevice('VTEXSwitch.mdd', ['TCPIP::' remote_ip '::INSTR']);
try
connect(handles.rfswitch_tcp_config);
catch ME1
disp(ME1.message)
end
Is there a dependency I need to include the MATLAB path when compiling? I see alot of file in C:\Program Files\IVI Foundation\IVI. I'm runing 32-bit R2013a in Windows XP.
Thanks
  1 Comment
Shawn Mason
Shawn Mason on 11 Jun 2013
I modified the icdevice.m file to get more information. Error is being thrown in the following function call:
if (~libisloaded(driverName))
errflag = localLoadLib(driverName, binary, includeFile, includePath, visaIncludePath)
end
After attempts to call "loadlibrary" the following exception message is generated:
Deployed applications must use a prototype file instead of a header file. To create the prototype, use the loadlibrary mfilename option. Use the prototype file in compiled code. See http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/brb8oui.html for more information.

Sign in to comment.

Accepted Answer

Shawn Mason
Shawn Mason on 11 Jun 2013
Found workaround, but unfourtunately breaks base-MATLAB and is device specific. I asked Mathworks for help with a more elegant solution now that I have a better idea of what the problem is.
1) Created prototype file by modifying this line in icdevice.m.
[~, warninginfo]= loadlibrary(binary, includeFile, 'mfilename', 'VS', 'alias', driverName, ...
includepath', primaryPath,'includepath', char(secondaryPath(1)), 'includepath', char(secondaryPath(2)));
2) Modified icdevice.m to call prototype if deployed.
if isdeployed
[~, warninginfo]= loadlibrary(binary, @VS, 'alias', driverName, ...
'includepath', primaryPath,'includepath', char(secondaryPath(1)), 'includepath', char(secondaryPath(2)));
else
[~, warninginfo]= loadlibrary(binary, includeFile, 'alias', driverName, ...
'includepath', primaryPath,'includepath', char(secondaryPath(1)), 'includepath', char(secondaryPath(2)));
end

More Answers (0)

Categories

Find more on Application Deployment in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!