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.

298 • Chapter 7: <strong>Advanced</strong> Connectivity• The options are used to specify argument passing conventions, libraries,or calling methods. See the appropriate sections of this chapterfor details.• If instead of the arg parameters, the single word MAPLE is specified, theexternal function is assumed to accept the raw Maple data structurespassed without conversion. This assumes that the wrapper has beenmanually generated and compiled into a DLL. Various support functionsfor writing such external functions are described in Method3: Customizing Wrappers on page 313. Using MAPLE instead ofspecifying arguments is the basis of method 3.• The name of the DLL containing the external function is specified byusing the LIB option to define_external. The dllName is a stringthat specifies the filename of the library in which the function is to befound. The format of this name is highly system dependent. Likewise,whether a full pathname is required depends on the system. In general,the name should be in the same format as would be specified to acompiler on the same system. When calling a Java function, dllNameis the name of the class containing the function.Type SpecificationStep two of the introductory example indicated how to specify types usingMaple notation. Maple uses its own notation to provide a generic welldefinedinterface for calling compiled code in any language.The format of each arg parameter is as follows.argumentIdentifier :: dataDescriptorThe return value description is also described by using a data descriptor,with the name RETURN as the argumentIdentifier. If the functionreturns no value, no RETURN parameter is specified. Also, if no parametersare passed, no argument identifiers are required.Scalar Data FormatsExternal libraries generally deal with scalar data supported directly by theunderlying machine. All array, string, and structured formats are built upfrom these. The data descriptors used to represent scalar formats usuallycontain a type name and size. The size represents the number of bytesneeded to represent the given hardware type. Table 7.1 lists the basic typetranslations for standard C, Fortran, and Java compilers.

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

Saved successfully!

Ooh no, something went wrong!