11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

char * concat( char* a, char *b ){char *r;if( !a || !b ) return( NULL );7.2 Using Compiled Code in Maple • 313r = (char*)malloc((strlen(a)+strlen(b)+1)*sizeof(char));strcpy(r,a);strcat(r,b);}return( r );Method 3: Customizing WrappersFor complete control over data conversions, Maple allows modification ofexisting wrappers and creation of custom wrappers. There are numerousC and Fortran functions available for translating and manipulating Mapledata structures.To use this method, you must be familiar with the steps required touse compiled code in Maple, described in Method 1: Calling ExternalFunctions on page 294. For this method, you do not declare a functionspecification because Maple passes one data structure containing allthe passed information. Therefore, there are only two basic steps (DLLcreation and function invocation as described on pages 295-296) in additionto wrapper generation. Wrappers were introduced in Method 2:Generating Wrappers on page 301.External Function Entry PointMaple finds the symbol name given as the first argument to define_externalin the DLL specified in the LIB= argument. Maple also finds theMWRAP_symbolName in the wrapper library. This MWRAP_symbolName functionprototype has the following format.ALGEB MWRAP_quadruple_it(MKernelVector kv,FLOAT32 (*fn) ( FLOAT32 a1 ),ALGEB fn_args);This prototype is taken from the wrapper quad.c described in theprevious section. The first argument kv is a handle to the Maple kernel

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

Saved successfully!

Ooh no, something went wrong!