| 1 |
'\" |
| 2 |
'\" Copyright (c) 2009-2010 Kevin B. Kenny |
| 3 |
'\" Copyright (c) 2010 Donal K. Fellows |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH Load 3 8.6 Tcl "Tcl Library Procedures" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
.SH NAME |
| 12 |
Tcl_LoadFile, Tcl_FindSymbol \- platform-independent dynamic library loading |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
\fB#include <tcl.h>\fR |
| 16 |
.sp |
| 17 |
int |
| 18 |
\fBTcl_LoadFile\fR(\fIinterp, pathPtr, symbols, flags, procPtrs, loadHandlePtr\fR) |
| 19 |
.sp |
| 20 |
void * |
| 21 |
\fBTcl_FindSymbol\fR(\fIinterp, loadHandle, symbol\fR) |
| 22 |
.SH ARGUMENTS |
| 23 |
.AS Tcl_LoadHandle loadHandle in |
| 24 |
.AP Tcl_Interp *interp in |
| 25 |
Interpreter to use for reporting error messages. |
| 26 |
.AP Tcl_Obj *pathPtr in |
| 27 |
The name of the file to load. If it is a single name, the library search path |
| 28 |
of the current environment will be used to resolve it. |
| 29 |
.AP "const char *const" symbols[] in |
| 30 |
Array of names of symbols to be resolved during the load of the library, or |
| 31 |
NULL if no symbols are to be resolved. If an array is given, the last entry in |
| 32 |
the array must be NULL. |
| 33 |
.AP int flags in |
| 34 |
The value should normally be 0, but \fITCL_LOAD_GLOBAL\fR or \fITCL_LOAD_LAZY\fR |
| 35 |
or a combination of those two is allowed as well. |
| 36 |
.AP void *procPtrs out |
| 37 |
Points to an array that will hold the addresses of the functions described in |
| 38 |
the \fIsymbols\fR argument. Should be NULL if no symbols are to be resolved. |
| 39 |
.AP Tcl_LoadHandle *loadHandlePtr out |
| 40 |
Points to a variable that will hold the handle to the abstract token |
| 41 |
describing the library that has been loaded. |
| 42 |
.AP Tcl_LoadHandle loadHandle in |
| 43 |
Abstract token describing the library to look up a symbol in. |
| 44 |
.AP "const char" *symbol in |
| 45 |
The name of the symbol to look up. |
| 46 |
.BE |
| 47 |
.SH DESCRIPTION |
| 48 |
.PP |
| 49 |
\fBTcl_LoadFile\fR loads a file from the filesystem (including potentially any |
| 50 |
virtual filesystem that has been installed) and provides a handle to it that |
| 51 |
may be used in further operations. The \fIsymbols\fR array, if non-NULL, |
| 52 |
supplies a set of names of symbols (typically functions) that must be resolved |
| 53 |
from the library and which will be stored in the array indicated by |
| 54 |
\fIprocPtrs\fR. If any of the symbols is not resolved, the loading of the file |
| 55 |
will fail with an error message left in the interpreter (if that is non-NULL). |
| 56 |
The result of \fBTcl_LoadFile\fR is a standard Tcl error code. The library may |
| 57 |
be unloaded with \fBTcl_FSUnloadFile\fR. |
| 58 |
.PP |
| 59 |
\fBTcl_FindSymbol\fR locates a symbol in a loaded library and returns it. If |
| 60 |
the symbol cannot be found, it returns NULL and sets an error message in the |
| 61 |
given \fIinterp\fR (if that is non-NULL). Note that it is unsafe to use this |
| 62 |
operation on a handle that has been passed to \fBTcl_FSUnloadFile\fR. |
| 63 |
.SH "SEE ALSO" |
| 64 |
Tcl_FSLoadFile(3), Tcl_FSUnloadFile(3), load(n), unload(n) |
| 65 |
.SH KEYWORDS |
| 66 |
binary code, loading, shared library |
| 67 |
'\" Local Variables: |
| 68 |
'\" mode: nroff |
| 69 |
'\" fill-column: 78 |
| 70 |
'\" End: |