VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to create a dll file from simulink model and real time workshop

Hello everybody,

i have a problem guys, i am trying to create a dll file from a simple example mdl file using MATLAB7.1 and NI VeriSTAND 2012.

But i've got this error:

 

Error using ==> NIVeriStand_wrap_make_cmd_hook NI VeriStand error ==> An error occured setting the make-file command options. Error using ==> rtw\private\issue_inv_comp_env_val_error 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)   %MSDevDir%\..\vc\bin\vcvars32.bat          (for Visual C/C++ 5.0)

You must define MSDevDir or DevEnvDir to be:   set %DevEnvDir%=<VisualRoot>\common7\ide   (for Visual C/C++ 7.1)   set %MSDevDir%=<VisualRoot>\common\msdev98 (for Visual C/C++ 6.0)   set %MSDevDir%=<VisualRoot>\sharedide      (for Visual C/C++ 5.0)

This error may be due to an invalid preference file:   C:\Users\Putz\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat Please run "mex -setup" at the MATLAB prompt to correct

 

Can anybody help me

 

Thanks

Josef

0 Kudos
Message 1 of 7
(9,717 Views)

Hi,

In reference to the line "run mex setup" you need to setup MatLab to use the correct compiler. Instructions can be found here.

 

Basically:

Type mex –setup in the command window. Select y to list the installed compilers and select the option number for Microsoft Visual C++ 2008 Express Edition with SP1.

0 Kudos
Message 2 of 7
(9,705 Views)

Hi,

 

thanks a lot for your reply

 

With the mex -setup it's all right but it didn't work and i think the problem is with the path, i don't know whether i should save the model file in certain directory or folder.

And here are the errors:

 

Error using ==> rtw\private\rtw_create_directory_path
Error creating directory 'C:\Program Files\MATLAB71\work\slprj\NIVeriStand\Test4'

Error building Real-Time Workshop target for block diagram 'Test4'. MATLAB error message:
Error using ==> slbuild
Error using ==> rtw\private\rtw_create_directory_path
Error creating directory 'C:\Program Files\MATLAB71\work\slprj\NIVeriStand\Test4' :

 

Can you please explain me what's the problem with this file or with the programm?

 

Thanks

 

Josef

 

 

0 Kudos
Message 3 of 7
(9,682 Views)

Hi JosefPXI

 

What compiler are you selecting in mex -setup? Please provide the string given to you in the MATLAB Command Window.

Nestor
0 Kudos
Message 4 of 7
(9,670 Views)

Hi Nestor,

 

i've used the compiler Visual C/C++ version 7.1 and i don't know what the warning below is meaning.

 

Select a compiler:
[1] Digital Visual Fortran version 6.0 in C:\Program Files\Microsoft Visual Studio
[2] Lcc C version 2.4.1 in C:\PROGRAM FILES\MATLAB71\sys\lcc
[3] Microsoft Visual C/C++ version 7.1 in C:\Program Files\Microsoft Visual Studio .NET 2003
[4] Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio
 
[0] None
 
Compiler: 3
 
Please verify your choices:
 
Compiler: Microsoft Visual C/C++ 7.1
Location: C:\Program Files\Microsoft Visual Studio .NET 2003
 
Are these correct?([y]/n): y
 
Try to update options file: C:\Users\Putz\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
From template:              C:\PROGRAM FILES\MATLAB71\BIN\win32\mexopts\msvc71opts.bat
 
Done . . .
 
***************************************************************************
  Warning: The file extension of 32-bit Windows MEX-files was changed
           from ".dll" to ".mexw32" in MATLAB 7.1 (R14SP3). The generated 
           MEX-file will not be found by MATLAB versions prior to 7.1.
           Use the -output option with the ".dll" file extension to
           generate a MEX-file that can be called in previous versions.
           For more information see: 
           MATLAB 7.1 Release Notes, New File Extension for MEX-Files on Windows
***************************************************************************
 
>>

Thanks

Regards Josef

 

 

0 Kudos
Message 5 of 7
(9,658 Views)

Nevermind, can't delete post

0 Kudos
Message 6 of 7
(9,652 Views)

This looks correct.

 

The warning is simply informing you that as of MATLAB 7.1, files compiled using the "mex mySource.c ..." command will generate a *.mexw32 and not a *.dll file. You may ignore this warning specifically for NI VeriStand models since we do not compile using the mex command. In the end, models produced by the script should be in the *.dll format.

 

Are you able to successfully build using grt.tlc? If you are unable to compile using MathWorks' TLC, please forward your issue to their forums. To verify the behavior, select "grt.tlc Visual C/C++ Project" from the System Target file browser in the models Configurations window.

 

I did a quick test and I was able to successfully compile a VeriStand model with MSVC++ 7.1.

Nestor
0 Kudos
Message 7 of 7
(9,639 Views)