08-18-2011 01:37 PM
I have a Matlab generated dll built with Matlab 2008b and it works fine with LabVIEW 2010 sp1 . If I recompile the code for the dll in Matlab 2010a it compiles fine just like in 2008b, however LabVIEW will not work with it.
Is there a known compatability issue with Matlab 2010 and if so, what about Matlab 2011
Thnaks much,
Adam
08-18-2011 02:07 PM
When you compile matlab code, the LabVIEW can recognize the DLL? I thought you still need a wrapper DLL to pass data, because LabVIEW and Matlab hold different data types.
Refer to this long post if you want to know how to create a wrapper DLL from VC.http://forums.ni.com/t5/LabVIEW/dll-matlab-an-LadVIEW/td-p/47127
I hope your approach works, that means there is no need to compile the DLL in VC again.
08-18-2011 02:45 PM - edited 08-18-2011 02:46 PM
Sorry, I should have been specific...
When I said that labview works with my compiled matlab 2008 code, I ment to imply that the mfile dll and the wrapper dll are all working fine with labview when compiled with matlab 2008. Matlab 2010 seems to compile both the code dll and wrapper dll just fine, however labview will no longer initalize the M-file dll
More specifically the wrapper dll starts and passes the mclInitializeApplication fine, but will always fail the m-code initalize...
(ie always returns -2)
Also, I do have the correct version of the mcr for 2010 running
int
DLLlinkInit(void)
{
mclmcrInitialize();
if(!mclInitializeApplication(NULL,0))
{
//std::cerr << "Could not initialize MCR" << std::endl;return-1;
}
if(!TKlibInitialize()){
//fprintf(stderr,"Could not initialize the library.\n");return-2;
}
return0;
}
Adam
08-18-2011 02:54 PM
Did you try 64-bit? I need both 32 and 64, but I am not sure whether 64 bit compile is possible yet.
08-18-2011 02:56 PM
Labview can't even recognize the dlls if they are compiled 64bit
08-24-2011 11:37 AM
It seems that you have more experience on this Matlab to LabVIEW issue.
With the Matlab DLL and the wrapper DLL loaded to LabVIEW, do you still need the MCR for each computer that you deploy your LabVIEW executables?
08-25-2011 09:29 AM
Yes,
If the LabView containes a DLL that was generated directly from Matlab code, then all Matlab calls within the DLL are resolved with the MCR. Your LabView application
should not even start if you do not have the proper version of the MCR installed.
BTW...
The solution to LabView with Matlab 2010 dlls not working is to upgrade your Matlab to 2011a and all goes back to working...
A
08-25-2011 10:17 AM
Is this MCR a free download like the LabVIEW run time engine?