This adds a new command libtclMotif.so, the sole function of which is to permit the calling of routines defined in the library, as shown in the example below.sgitcl>dlopen libtclMotif.so
There are two types of routines that may be called: init routines and call routines.sgitcl>libtclMotif.so call procedure args...
The init routine has the following prototype:
The interp argument is set to the interpreter pointer created by Tcl. To reference an init routine, type:int Init_Routine(Tcl_Interp* interp)
The call routine has the following prototype:sgitcl>library-name init Init-routine
The interp argument is the Tcl interpreter; argc is a count of arguments and argv is an array of argument strings with argc elements in the array. To call such a routine, type:int Call_Routine(Tcl_Interp* interp, int argc, char* argv[])
Tcl will parse the args in the same way that command arguments are parsed, and pass them to the routine in argc and argv.sgitcl>library-name call routine-name args...
Both routine types should return TCL_OK if successful or TCL_ERROR if something went wrong. Additionally, your procedure should set interp->result to a descriptive error string. The return value of an init or call routine will be the value that your procedure places in interp->result, or the empty string if you fail to set a return value.
Note that dlopen allows an optional init or call to follow the library name:
sgitcl>dlopen libname.so init init-routine