MATLAB Compiler User's Guide

MATLAB Compiler User's Guide

MATLAB Compiler The Language of Technical Computing Computation Visualization Programming User’s Guide Version 2 How to Contact The MathWorks: 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc. Mail 24 Prime Park Way Natick, MA 01760-1500 http://www.mathworks.com Web ftp.mathworks.com Anonymous FTP server comp.soft-sys.matlab Newsgroup [email protected] Technical support [email protected] Product enhancement suggestions [email protected] Bug reports [email protected] Documentation error reports [email protected] Subscribing user registration [email protected] Order status, license renewals, passcodes [email protected] Sales, pricing, and general information MATLAB Compiler User’s Guide COPYRIGHT 1984 - 1999 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro- duced in any form without prior written consent from The MathWorks, Inc. U.S. GOVERNMENT: If Licensee is acquiring the Programs on behalf of any unit or agency of the U.S. Government, the following shall apply: (a) For units of the Department of Defense: the Government shall have only the rights specified in the license under which the commercial computer software or commercial software documentation was obtained, as set forth in subparagraph (a) of the Rights in Commercial Computer Software or Commercial Software Documentation Clause at DFARS 227.7202-3, therefore the rights set forth herein shall apply; and (b) For any other unit or agency: NOTICE: Notwithstanding any other lease or license agreement that may pertain to, or accompany the delivery of, the computer software and accompanying documentation, the rights of the Government regarding its use, reproduction, and disclo- sure are as set forth in Clause 52.227-19 (c)(2) of the FAR. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and Target Language Compiler is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders. Printing History: September 1995 First printing March 1997 Second printing January 1998 Third printing Revised for Version 1.2 January 1999 Fourth printing Revised for Version 2.0 (Release 11) Contents Introducing the MATLAB Compiler 1 Introduction .............................................. 1-2 BeforeYouBegin..................................... 1-2 NewFeatures........................................ 1-3 DataConstructs ................................... 1-3 ProgrammingTools................................. 1-4 LanguageEnhancements............................ 1-4 ImprovedCompilerOptions.......................... 1-5 MacroOptions..................................... 1-5 Error/WarningMessages ............................ 1-5 ImprovedmexandmbuildScripts..................... 1-5 Stand-AloneCompiler............................... 1-5 CompilerLicensingChanges ........................... 1-6 RunningMATLABNotRequired...................... 1-6 DedicatedCompilerLicense.......................... 1-6 MATLABCompiler1.2Users........................... 1-7 DifferencesBetweenCompiler1.2and2.0 .............. 1-7 Optimization ...................................... 1-7 Overview .................................................. 1-8 CreatingMEX-Files................................... 1-8 CreatingStand-AloneApplications ...................... 1-9 CStand-AloneApplications.......................... 1-9 C++Stand-AloneApplications....................... 1-10 DevelopingaStand-AloneApplication ................ 1-11 The MATLAB Compiler Family ........................... 1-13 Why Compile M-Files? .................................... 1-15 FasterExecution.................................... 1-15 CasesWhenPerformanceDoesNotImprove ........... 1-15 CasesWhenPerformanceDoesImprove............... 1-15 Compiler1.2Functionality.......................... 1-15 HidingProprietaryAlgorithms......................... 1-16 Stand-AloneApplicationsandLibraries ................. 1-16 i Upgrading from Previous Versions ....................... 1-18 MATLABCompiler1.2 ............................... 1-18 Compatibility..................................... 1-18 Installation . .............................. 1-18 MATLABCompiler1.0/1.1 ............................ 1-18 ChangedLibraryName............................. 1-18 ChangedDataTypeNames.......................... 1-18 Installation and Configuration 2 Getting Started ............................................ 2-2 Overview............................................ 2-2 UNIX Workstations ........................................ 2-5 SystemRequirements ................................. 2-5 SupportedANSICandC++UNIXCompilers............ 2-6 CompilerOptionsFiles .............................. 2-6 LocatingOptionsFiles............................... 2-7 Installation . ............................... 2-7 MATLABCompiler ................................. 2-7 ANSICorC++Compiler............................. 2-7 ThingstoBeAwareof............................... 2-8 mexVerification...................................... 2-8 ChoosingaCompiler................................ 2-8 ChangingCompilers ................................ 2-9 CreatingMEX-Files................................ 2-10 MATLABCompilerVerification........................ 2-12 VerifyingfromMATLAB............................ 2-12 VerifyingfromUNIXCommandPrompt............... 2-12 Microsoft Windows on PCs ............................... 2-14 SystemRequirements ................................ 2-14 SupportedANSICandC++PCCompilers ............. 2-15 CompilerOptionsFiles ............................. 2-16 LocatingOptionsFiles.............................. 2-17 ii Contents Installation . .............................. 2-17 MATLABCompiler ................................ 2-17 ANSICorC++Compiler............................ 2-18 ThingstoBeAwareof.............................. 2-18 mexVerification..................................... 2-19 ChoosingaCompiler............................... 2-19 ChangingCompilers ............................... 2-20 CreatingMEX-Files................................ 2-22 MATLABCompilerVerification........................ 2-23 VerifyingfromMATLAB............................ 2-23 VerifyingfromDOSCommandPrompt................ 2-24 Troubleshooting .......................................... 2-25 mexTroubleshooting................................. 2-25 CannotLocateYourCompiler(PC) ................... 2-26 InternalErrorWhenUsingmex–setup(PC) ........... 2-26 VerificationofmexFails............................ 2-26 TroubleshootingtheCompiler.......................... 2-27 LicensingProblem................................. 2-27 MATLAB Compiler Does Not Generate MEX-File . 2-27 Getting Started with MEX-Files 3 A Simple Example ......................................... 3-3 SierpinskiGasketExample............................. 3-3 HowtheFunctionWorks............................. 3-3 InvokingtheM-File................................... 3-4 CompilingtheM-FileintoaMEX-File.................... 3-5 InvokingtheMEX-File ................................ 3-6 Compiler Options .......................................... 3-7 Macros.............................................. 3-7 UnderstandingaMacroOption ....................... 3-8 CommandLineSyntax ................................ 3-9 ConflictingOptionsonCommandLine ................ 3-10 iii Limitations and Restrictions ............................. 3-11 MATLABCode...................................... 3-11 Stand-AloneApplications ............................. 3-12 Generating Simulink S-Functions ........................ 3-14 Simulink-SpecificOptions............................. 3-14 Usingthe-SOption................................ 3-14 Usingthe-uand-yOptions ......................... 3-15 SpecifyingS-FunctionCharacteristics................... 3-15 SampleTime ..................................... 3-15 DataType........................................ 3-16 Converting Script M-Files to Function M-Files ........... 3-17 Stand-Alone Applications 4 Introduction ............................................... 4-2 Differences Between MEX-Files andStand-AloneApplications.......................... 4-2 Stand-AloneCApplications............................. 4-2 Stand-AloneC++Applications .......................... 4-3 Building Stand-Alone C/C++ Applications ................. 4-5 Overview............................................ 4-5 PackagingStand-AloneApplications................... 4-6 GettingStarted ...................................... 4-7 Introducingmbuild ................................. 4-7 CompilerOptionsFiles .............................. 4-7 Building Stand-Alone Applications on UNIX ............... 4-9 ConfiguringforCorC++............................... 4-9 LocatingOptionsFiles............................... 4-9 PreparingtoCompile................................. 4-10 UsingtheSystemCompiler ......................... 4-10 ChangingCompilers ............................... 4-10 iv Contents Verifyingmbuild .................................... 4-12 LocatingSharedLibraries........................... 4-13 RunningYourApplication........................... 4-14 VerifyingtheMATLABCompiler....................... 4-14 DistributingStand-AloneUNIXApplications ............. 4-14 Installing C++ and Fortran Support . ................. 4-15 AboutthembuildScript .............................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    386 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us