Programming Guide |
Opens a library
int sm_l_open(char *lib_name);
lib_name
- The name of the library to open. Panther searches for
lib_name
in the current directory, then along the path given tosm_initcrt
, and finally along the path defined bySMPATH
.
- 1 The library file's identifier.
- -1 The library cannot be opened or read.
Use
sm_l_open
to open a library before you use a JPL module, a menu, or a screen that is in that library.sm_l_open
opens a library in these steps:
- Allocates space in which to store information about the library.
- Leaves the library file open, and returns a descriptor that identifies the library. You can use this descriptor to explicitly search a single library—for example, to find a screen in a specific library with sm_l_window.
If you define the SMFLIBS variable in your setup file as a list of library names, Panther automatically calls
sm_l_open
for those libraries.Panther has no limit on the number of libraries you can have open at the same time. Note that some systems have severe limits on memory or simultaneously open files.
/* Prompt for the name of a library until a
* valid one is found. Assume the memory-resident
* screen contains one field for entering the library
* name, with suitable instructions. */int ld;
extern char libquery[];
if (sm_d_form(libquery) < 0)
sm_cancel();
sm_d_msg_line("Please enter the name of your library.");
do {
sm_input(IN_DATA);
} while ((ld = sm_l_open(sm_fptr (1))) < 0);
sm_form, sm_jplcall, sm_jplpublic, sm_l_close, sm_window