11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.2 Using Compiled Code in Maple • 307• If any other Maple expression is passed, its value is passed by reference,and the revised value is discarded.Compiler OptionsTo compile the wrapper library, Maple requires the use of a C compilerinstalled on the same machine that is running Maple. Maple generatesa system command to call the compiler. The compiler must be recognizedby the system. It should be in the system PATH and all associatedenvironment variables must be set.The compile and link commands are completely customizable providedthat your compiler has a command-line interface. Default configurationsare provided, which should make most cases work “out of the box.” Mapleis preprogrammed to use the vendor-supplied C compiler to compile wrapperson most platforms. 1All default compile and link options are stored in a module that can beobtained by using the command define_external(‘COMPILE_OPTIONS‘).When the module returned by this command is modified, the modificationaffects all wrapper generation commands via define_external forthe remainder of the session. All of the names exported by the compileoptions module can also be specified as a parameter to define_external.When specified as a parameter, the effect lasts only for the duration ofthat call.The compile and link commands are assembled by calling theCOMPILE_COMMAND and LINK_COMMAND procedures defined in the compileoptions module. These procedures make use of the definitions in the compileoptions module to formulate a command string that is executed usingssystem. 2To customize the compile and link commands, you can modify thefollowing options. All option values must be strings or NULL, except forCOMPILE_COMMAND and LINK_COMMAND, which must be procedures or NULL.COMPILER This specifies the name of the compiler executable.CFLAGS This specifies miscellaneous flags passed to the compiler.COMPILE_ONLY_FLAG This flag indicates that the file is only tobe compiled. On most platforms it is “-c”, which causes the compilerto generate an object file, but not link it to form any executable orlibrary. A separate command performs the linking.1 Under Microsoft Windows, Maple uses the Microsoft Visual C Compiler.2 If using the Microsoft C compiler, the LINK_COMMAND is set to NULL since theCOMPILE_COMMAND does both the compiling and linking.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!