MATLAB: Am I unable to compile the Ada S-function using a version of the GNAT Ada compiler more recent than 3.13b

adabugcompilecompilererrorgnats-functionsimulinkversion

When I try to compile my Ada code S-function using a GNAT Ada compiler more recent than 3.13b, it does not work.

Best Answer

There is an updated version of the mex.pl file available that will work with versions of the GNAT Ada compiler more recent than 3.13b. Here are the instructions:
1. Open your current mex.pl file in a text editor. The mex.pl file is located at the following directory:
$MATLAB/bin/(arch)/mex.pl
where $MATLAB is the root MATLAB directory and (arch) is the architecture you are using MATLAB on.
For instance, for the default installation of MATLAB on a Windows operating system this would be:
C:\MATLAB6p5\bin\win32\mex.pl
2. Make sure your current version of mex.pl is revision 1.161. Line 8 of the mex.pl file should start with
# $Revision: 1.161
3. If your revision is earlier than 1.161, you will need to upgrade your version of MATLAB before you can implement this enhancement.
4. If your revision is later than 1.161, contact MathWorks for advice. You can contact MathWorks Technical Support by phone at 508-647-7000 or through the web at:
5. Download the "mex.zip" file using the link at the bottom of this page, unzip the file to obtain the "mex.pl" script, and place it in the same directory mentioned in step 1.
6. Restart MATLAB
7. Compile your S-function by using the MEX command.
This new updated version of mex.pl will allow you to use more recent versions of the GNAT Ada compiler. It will also allow you to add directories to the compiler search path using the -I flag.