MATLAB: Compiling a IVI Driver in R2013a

Instrument Control Toolboxiviivi-civi-comMATLABMATLAB Compilermdd

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

Best Answer

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