External Code - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Applications and Example Worksheets : Connectivity : examples/ExternalCode

External Code



The source code for many of the OpenMaple and define_external examples shown in these help pages is available in the samples directory of your Maple installation. In particular, samples/ExternalCall/HelpExamples/HelpExamples.c contains the source for all API function examples, and samples/OpenMaple/HelpExamples contains separate example C files for each StartMaple callback.


To build an OpenMaple application you need to specify the include path to maplec.h, which is found in the $MAPLE/extern/include directory. You also need to link to the maplec.lib (or libmaplec.so) library.Before running your application make sure the appropriate path is set.


The following are sample command lines for building the sample program found in $MAPLE/samples/OpenMaple/simple for various platforms. Each command has two parts, the first line for setting the load-library search path, and the second for building the application. These all assume the environment variable $MAPLE is set to the Maple install directory (eg. MAPLE=/usr/local/maple).

O/S                     Environment                    Compile Command                   
Linux (64-bit)          LD_LIBRARY_PATH=               gcc simple.c -o simple            
                          $MAPLE/bin.X86_64_LINUX        -I$MAPLE/extern/include         
                                                         -lmaplec -lrt                   
Mac OS X                DYLD_LIBRARY_PATH=             gcc simple.c -o simple             
(Intel 64-bit)             $MAPLE/                        -I$MAPLE/extern/include          
                                      bin.APPLE_UNIVERSAL_OSX        -L$MAPLE/bin.APPLE_UNIVERSAL_OSX           
Windows (32-bit)        PATH=                          cl simple.c -Fe:simple.exe        
                          $MAPLE/bin.win                 -I$MAPLE/extern/include         

Windows (64-bit)        PATH=                          cl simple.c -Fe:simple.exe        
                             $MAPLE/bin.X86_64_WINDOWS         -I$MAPLE/extern/include         


For information about building examples for use with define_external, see ?SharedLibrary.

Return to Example Worksheet Index

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam