ExternalCalling - Maple Help

Home : Support : Online Help : Programming : Calling External Routines : ExternalCalling : ExternalCalling/DefineExternal

ExternalCalling

 DefineExternal
 create a link to an external function

 Calling Sequence DefineExternal( fn, extlib ) DefineExternal( fn, extlib, cright )

Parameters

 fn - string or name; denotes the name of the wrapper function to link extlib - string or name; denotes the name of the external library containing the wrapper function cright - (optional) string; denotes the copyright placed on the returned Maple procedure.

Description

 • The DefineExternal(fn, extlib) command calls define_external with the MAPLE option and saves the result in a remember table.  The procedure used to prepare the invocation of the external routine fn is returned, optionally with the specified copyright statement cright.
 Note: Saving the result of DefineExternal in a remember table is essential for the efficient operation of the external linking. Without it, the external communications must be set up every time an external routine is entered.

Examples

 > $\mathrm{with}\left(\mathrm{ExternalCalling}\right):$
 > $\mathrm{extlib}≔\mathrm{ExternalLibraryName}\left("mstring"\right)$
 ${\mathrm{extlib}}{:=}{"libmstring.so"}$ (1)
 > $\mathrm{extcall}≔\mathrm{DefineExternal}\left('\mathrm{mstring_uppercase}',\mathrm{extlib}\right)$
 ${\mathrm{extcall}}{:=}{\mathbf{proc}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{option}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{call_external}}{,}{\mathrm{define_external}}{}\left({\mathrm{mstring_uppercase}}{,}{\mathrm{MAPLE}}{,}{\mathrm{LIB}}{=}{"libmstring.so"}\right){;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{call_external}}{}\left({0}{,}{140610421687856}{,}{\mathrm{true}}{,}{\mathrm{false}}{,}{\mathrm{args}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (2)
 > $\mathrm{extcall}≔\mathrm{DefineExternal}\left('\mathrm{mstring_uppercase}',\mathrm{extlib},"Copyright \left(c\right) 2001, ..."\right)$
 ${\mathrm{extcall}}{:=}{\mathbf{proc}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{option}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{call_external}}{,}{\mathrm{define_external}}{}\left({\mathrm{mstring_uppercase}}{,}{\mathrm{MAPLE}}{,}{\mathrm{LIB}}{=}{"libmstring.so"}{,}{\mathrm{COPYRIGHT}}{=}{"Copyright \left(c\right) 2001, ..."}\right){,}{\mathrm{copyright}}{=}{"Copyright \left(c\right) 2001, ..."}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{call_external}}{}\left({0}{,}{140610421687856}{,}{\mathrm{true}}{,}{\mathrm{false}}{,}{\mathrm{args}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (3)