MapleLibName - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


MapleLibName

set or query libname in external code

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

MapleLibName(kv, val)

Parameters

kv

-

kernel handle of type MKernelVector

val

-

expression sequence object containing strings

Description

• 

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 libnameval.

• 

Never directly modify the expression sequence returned by MapleLibName. Always create a new expression sequence to change the value.

Examples

    #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.

withExternalCalling&colon;

dllExternalLibraryNameHelpExamples&colon;

initDefineExternalMyLoadPackage&comma;dll&colon;

libname

/usr/local/maple/lib

(1)

init

true

(2)

libname

/usr/local/maple/lib,/home/paul/tool_lib

(3)

See Also

CustomWrapper

define_external

exprseq

OpenMaple

OpenMaple/C/API

OpenMaple/C/Examples