define_external(..., GENARGS=f, ...)
save an external procedure
Calling Sequence
Parameters
Description
Examples
define_external( functionName ..., GENARGS=f, ...)
functionName
-
name of externally defined subroutine
f
procedure used to generate a partial argument list
Procedures returned by the define_external command contain runtime information about the linkage to their corresponding external library. Instead of saving this information which is only valid for the current session, Maple saves the original parameter sequence passed to define_external. These parameters are used to regenerate the external procedure in the next Maple session.
The parameters used by define_external are not always machine independent. For example, on a Windows machine you may link to "mystuff.dll", while on a Linux system, the filename must be "libmystuff.so". Similarly, arguments may contain installation specific references to paths. Use the GENARGS=f option to specify a command to generate platform-specific arguments to define_external. This option is replaced by the return value of f⁡functionName. This happens before processing of all arguments.
The following links to the Windows version of clapack.dll that comes with Maple. If you only ever use this function on Windows, it is fine to declare it in the usual way.
dgetrf := define_external('dgetrf_',
'm':REF(integer[4]),
'n':REF(integer[4]),
'a':ARRAY(float[8]),
'lda':REF(integer[4]),
'ipiv':ARRAY(integer[4]),
'info':REF(integer[4]),
'LIB'="clapack.dll"
):
If you want to use the same function on both Windows and Linux, you may want to declare it as follows.
'GENARGS'=proc()
'LIB'=ExternalCalling:-ExternalLibraryName("clapack");
end proc
Other arguments can be returned as well as 'LIB'. When defining a named procedure, ensure it is saved.
clapack_args := proc( fn:string )
if fn = "dgetrf_" then
end if;
end proc;
dgetrf := define_external("dgetrf_",'GENARGS'=clapack_args):
See Also
COMPILE_OPTIONS
CustomWrapper
define_external
define_external,types
SharedLibrary
trademarks
WRAPPER
Download Help Document