LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

does creating a labview dll from simulink model require visual studio

Solved!
Go to solution

I've asked the same question at the Simulink forums, but maybe someone here has the answer: 

 

I'm trying to perform this process here:

 

http://zone.ni.com/devzone/cda/tut/p/id/3447

 

However, I get the following errors from the Simulink Real Time Workshop:

 

Error building Real-Time Workshop target for block diagram 'SensorCAN_sfcn'. MATLAB error message:
Error using ==> setup_for_visual>LocIssueMSDevError at 324
Invalid setting for environment variable MSDevDir or DevEnvDir.
The setting is: ''
You can verify the setting by checking for the existence of:
  %DevEnvDir%\..\tools\vsvars32.bat          (for Visual C/C++ 7.1)
  %MSDevDir%\..\..\vc98\bin\vcvars32.bat     (for Visual C/C++ 6.0)
  %DevEnvDir%\..\tools\vsvars32.bat          (for Visual C/C++ 8.0)

 

I do not use Visual C, what little programming I do has been done in Borland Builder or with command line gcc.  Is there any way to make simulink look for a different dev environment?  Or does this process require Visual C?

0 Kudos
Message 1 of 10
(4,756 Views)
Solution
Accepted by topic author VTChris

Hey,

 

It depends on what version of SIT you are using.

With SIT 5.0 and later you can use a free compiler like described here:

      http://digital.ni.com/public.nsf/allkb/AAD15283A1F051A1862574F000744DBD?OpenDocument

With earlier versions you need VS 2006.

 

Hope this helps,

Christian

Message 2 of 10
(4,740 Views)

Thanks, I've got SIT 5.0 installled, but it turns out we have a site license for VS 2008, so I now have that as well.  I've got a new problem though, and although I think it's related to Simulink, these forums seems a little more responsive than that Matlab forums. So....

 

I’m working with someone else's s-code, and I haven't used Simulink in the past. As I said in my original post, I am attempting to use SIT to turn the s-code into a dll for use in a LabView RT application. I opened the mdl file in Simulink, and I’m now trying to build the LabView dll in the Simulink Real Time Workshop.  The target file is nidll.tlc and Matlab starts the SIT when launched, so it appears the tools are aware of each other.  However, when I attempt to build the dll, I get the following error:

fatal error C1083: Cannot open include file: 'rtlibsrc.h': No such file or directory

I’m using the following: Matlab 2008b, SIT 5.0, and MS Visual Studio 2008, so the libraries and includes should be fairly up to date. What I don't get is that the files that are calling for this include are auto-generated by Simulink, so I don't know why it's not finding the rtlibsrc.h. Still, I found that in the RTW subdirectory, and copied it into my local directory. This gives me a different error:

### Linking ...
C:\PROGRA~1\MATLAB\R2008b\sys\perl\win32\bin\perl C:\PROGRA~1\MATLAB\R2008b\rtw\c\tools\mkvc_lnk.pl SensorCAN_sfcn.lnk SensorCAN_sfcn.obj rtGetInf.obj rtGetNaN.obj rt_logging.obj rt_matrx.obj rt_nonfinite.obj rt_printf.obj rt_sfcn_helper.obj nidll_main.obj rt_sim.obj SensorCAN_sfcn.res SensorCAN0_sf.obj
link /RELEASE /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup@12 -dll /NODEFAULTLIB:MSVCRT LIBCMT.LIB kernel32.lib ws2_32.lib mswsock.lib advapi32.lib @SensorCAN_sfcn.lnk /dll -out:SensorCAN_sfcn.dll
   Creating library SensorCAN_sfcn.lib and object SensorCAN_sfcn.exp
SensorCAN0_sf.obj : error LNK2019: unresolved external symbol _rt_Lookup referenced in function _mdlOutputs

Again, self-generated code, now with unresolved external symbols? I'm assuming that I'm linking the wrong version of a dll or obj that contains mdlOutputs, which appears to be something from Matlab. Can anyone point me in the correct direction? Missing headers and incorrect libraries lead me to believe that I've got a search path issue somewhere, but the Matlab/Simulink/LabView/Visual Studio are all fresh default installs.

0 Kudos
Message 3 of 10
(4,726 Views)
VTChris-

What version of LabVIEW are you planning on porting your model into?  We need to check that SIT 5.0 will work with that version.  This can be done by reviewing the SIT 5.0 ReadMe.
Regards,

Mike S
NI AE
0 Kudos
Message 4 of 10
(4,682 Views)

I'm using the following software versions (listed by order of installation):

 

MS Visual Studio 9.0.21022.8 (R2008)

MATLAB 7.7 (R2008b)
Simulink 7.2 (R2008b)

Real-Time Workshop 7.2 (R2008b)

LabView 8.6

SIT 5.0

0 Kudos
Message 5 of 10
(4,659 Views)
I also attempted to export some of the example s-functions (found by typing "sfundemos" at the MATLAB prompt) to LabVIEW, which resulted in similar errors.
0 Kudos
Message 6 of 10
(4,655 Views)
VTChris-

Take a look at the “sinewave.mdl” located at C:\Program Files\National Instruments\LabVIEW 8.6\examples\Simulation Interface\Sine Wave.  Can you compile that model to a dll? 

What compiler are you using to create this dll?
Regards,

Mike S
NI AE
0 Kudos
Message 7 of 10
(4,628 Views)

I found that tutorial, and posted a new topic regarding that because I didn't think this subject title was an accurate representation of the question.  You'll find that post here:

 

http://forums.ni.com/ni/board/message?board.id=170&message.id=444783#M444783

0 Kudos
Message 8 of 10
(4,612 Views)
whoops.... clicked on a solution link on the right, is there any way to reset the "accepted solution" tag?
0 Kudos
Message 9 of 10
(4,607 Views)
VTChris-

I spoke with one of our Applications Engineers you have been working with on phone support about this issue.  We decided he would work on your issue and I would assist him but communication will continue over the phone and direct e-mail.  We will be happy to continue assisting you there.

In order to remove the “Accepted Solution”, it should be in the options where you accepted the solution. 
Regards,

Mike S
NI AE
0 Kudos
Message 10 of 10
(4,576 Views)