LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a Matlab DLL in CVI?

Hi,
I've managed to compile a DLL from Matlab code using MSVC 8.0. When trying to use the DLL functions in a Labwindows/CVI 8 project, I have to import several h-files as well, which causes trouble. wchar.h (include file from MSVC) is required, and this file in turn includes some other files (crtdefs.h, string.h) with some syntax CVI doesn't accept.
 
I've tried using the LCC compiler from Matlab, but this DLL generated linking errors in CVI, as described in other posts in this forum. I hope some of you know how to generate a DLL in Matlab and use it in CVI and can help me with this. I know it's possible to access Matlab using some ActiveX stuff, but with a Matlab DLL you only need a few runtime files, not the whole package (as far as I know).
0 Kudos
Message 1 of 5
(5,143 Views)

Hi,

What version of Matlab are you using?

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 2 of 5
(5,113 Views)
I'm using Matlab 7.3.0.267 (R2006b).
0 Kudos
Message 3 of 5
(5,104 Views)
Did you create a header file representing your DLL in Labwindows? then generate a DLL import library (.lib) from the header? If not try this, I had a similar problem importing a dll from the LUA scripting language also built with MSVC 8.0 and performing the above tasks stopped the linking problems.
John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 4 of 5
(5,078 Views)
I found a workaround for this. Simply create an empty wchar.h within the project. The compiler won't say that can't compile because it can't find wchar.h and all will work perfectly.

>>>El día mar, Jul 10, 2007 a las 10:40 , en el mensaje
<1184056814037-548105@exchange.ni.com>, Halvor<x@no.email> escribió:
>Hi,
>I've managed to compile a DLL from Matlab code using MSVC 8.0. When
>trying to use the DLL functions in a Labwindows/CVI 8&nbsp;project, I have
>to import several h-files as well, which causes trouble. wchar.h (include
>file from MSVC)&nbsp;is required, and this file in turn includes some
>other files (crtdefs.h, string.h) with some&nbsp;syntax CVI doesn't
>accept.
>&nbsp;
>I've tried using the LCC compiler from Matlab, but this DLL generated
>linking errors in CVI, as described in other posts in this forum. I hope
>some of you know how to generate a DLL in Matlab and use it in CVI and
>can help me with this. I know it's possible to access Matlab using some
>ActiveX stuff, but with a Matlab DLL you only need a few runtime files,
>not the whole package (as far as I know).
0 Kudos
Message 5 of 5
(4,991 Views)