MapleLibName
set or query libname in external code
Calling Sequence
Parameters
Description
Examples
MapleLibName(kv, val)
kv
-
kernel handle of type MKernelVector
val
expression sequence object containing strings
This function can be used in external code with OpenMaple or define_external.
MapleLibName returns the currently assigned value of libname, which controls the location of Maple libraries. If val is not NULL, then it also tries to assign libname≔val.
Never directly modify the expression sequence returned by MapleLibName. Always create a new expression sequence to change the value.
#include <string.h>
#include "maplec.h"
ALGEB M_DECL MyLoadPackage( MKernelVector kv, ALGEB *args )
{
M_INT n, i;
ALGEB libname, newlibname;
char *mylib, buf[1024];
mylib = getenv("HOME");
if( mylib ) {
mylib = strncpy(buf,mylib,1010);
mylib[1010] = '0';
}
else {
mylib = strcpy(buf,"/usr/local");
strcat(mylib,"/tool_lib");
libname = MapleLibName(kv,NULL);
n = MapleNumArgs(kv,libname);
newlibname = NewMapleExpressionSequence(kv,n+1);
for( i=1; i<=n; ++i ) {
newlibname[i] = libname[i];
((ALGEB*)newlibname)[i] = ToMapleString(kv,mylib);
MapleLibName(kv,newlibname);
return( ToMapleBoolean(kv,TRUE) );
Execute the external function from Maple.
with⁡ExternalCalling:
dll≔ExternalLibraryName⁡HelpExamples:
init≔DefineExternal⁡MyLoadPackage,dll:
libname
/usr/local/maple/lib
init⁡
true
/usr/local/maple/lib,/home/paul/tool_lib
See Also
CustomWrapper
define_external
exprseq
OpenMaple
OpenMaple/C/API
OpenMaple/C/Examples
Download Help Document