release() — Delete a load module
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
z/OS® UNIX | C only |
Format
#include <stdlib.h>
int release(void(*fetch_ptr)());
General description
Removes from memory the load modules retrieved by fetch() or fetch control blocks created by fetchep(). The fetch_ptr parameter is obtained from a call to fetch() or fetchep(). Once released, the fetch() and any associated fetchep() pointers are no longer valid.
To avoid infringing on the user's name space, this nonstandard function has two names. One name, the external entry point name is prefixed with two underscore characters, and the other name is not. The name without the prefix underscore characters is exposed only when you use LANGLVL(EXTENDED).
To use this function, you must either invoke the function using its external entry point name (that is, the name that begins with two underscore characters __rlse(), or compile with LANGLVL(EXTENDED). When you use LANGLVL(EXTENDED) any relevant information in the header is also exposed.
All fetched modules and fetch control blocks created by fetchep() are released automatically on program termination.
Using release() on a module obtained by using fetch() will also cause the release() of any child fetch control blocks created by fetchep() for this module. However, using release() on a child fetch control block will have no effect on the parent modules or sibling fetch control blocks obtained by using fetch(). Trying to use a fetch control block after it has been released will result in undefined behavior. (A Fetch Control Block (FECB) is an internal executable control block. The fetch pointer points to it.
When non-reentrant modules have been fetched multiple times, you should release them in the reverse order; otherwise, the load modules may not be deleted immediately.
Returned value
If successful, release() returns 0.
If unsuccessful, release() returns nonzero.
Example
/* The following C example uses the fetch() function to load a module, and
later uses release() to delete the module from memory.
*/
#include <stdlib.h>
void (*fetch_ptr)();
int main(void) {
fetch_ptr = fetch("sample");
⋮
release(fetch_ptr); /* all modules are released */
}