Tcl8.6b2/Tk8.6b2 Documentation > TclLib > Load

Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands, version 4.0b7 | TDBC Package Commands, version 1.0b17 | Thread Package Commands, version 2.6.7 | Tcl Library | Tk Library | [incr Tcl] Package Library, version 4.0b7 | TDBC Package Library, version 1.0b17

NAME
Tcl_LoadFile, Tcl_FindSymbol — platform-independent dynamic library loading
SYNOPSIS
#include <tcl.h>
int
Tcl_LoadFile(interp, pathPtr, symbols, flags, procPtrs, loadHandlePtr)
void *
Tcl_FindSymbol(interp, loadHandle, symbol)
ARGUMENTS
DESCRIPTION
SEE ALSO
KEYWORDS

NAME

Tcl_LoadFile, Tcl_FindSymbol — platform-independent dynamic library loading

SYNOPSIS

#include <tcl.h>
int
Tcl_LoadFile(interp, pathPtr, symbols, flags, procPtrs, loadHandlePtr)
void *
Tcl_FindSymbol(interp, loadHandle, symbol)

ARGUMENTS

Tcl_Interp *interp (in)
Interpreter to use for reporting error messages.

Tcl_Obj *pathPtr (in)
The name of the file to load. If it is a single name, the library search path of the current environment will be used to resolve it.

const char *const symbols[] (in)
Array of names of symbols to be resolved during the load of the library, or NULL if no symbols are to be resolved. If an array is given, the last entry in the array must be NULL.

int flags (in)
Reserved for future expansion. Must be 0.

void *procPtrs (out)
Points to an array that will hold the addresses of the functions described in the symbols argument. Should be NULL if no symbols are to be resolved.

Tcl_LoadHandle *loadHandlePtr (out)
Points to a variable that will hold the handle to the abstract token describing the library that has been loaded.

Tcl_LoadHandle loadHandle (in)
Abstract token describing the library to look up a symbol in.

const char *symbol (in)
The name of the symbol to look up.

DESCRIPTION

Tcl_LoadFile loads a file from the filesystem (including potentially any virtual filesystem that has been installed) and provides a handle to it that may be used in further operations. The symbols array, if non-NULL, supplies a set of names of symbols (typically functions) that must be resolved from the library and which will be stored in the array indicated by procPtrs. If any of the symbols is not resolved, the loading of the file will fail with an error message left in the interpreter (if that is non-NULL). The result of Tcl_LoadFile is a standard Tcl error code. The library may be unloaded with Tcl_FSUnloadFile.

Tcl_FindSymbol locates a symbol in a loaded library and returns it. If the symbol cannot be found, it returns NULL and sets an error message in the given interp (if that is non-NULL). Note that it is unsafe to use this operation on a handle that has been passed to Tcl_FSUnloadFile.

SEE ALSO

Tcl_FSLoadFile, Tcl_FSUnloadFile, load, unload

KEYWORDS

binary code, loading, shared library
Copyright © 2009-2010 Kevin B. Kenny Copyright © 2010 Donal K. Fellows