Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

unload(3)

ldr_entry(3)

ldr_lookup(3)

ldr_xload(3)

load(3)  —  Subroutines

OSF

NAME

load −  Loads a module and returns the module ID

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <sys/types.h>
#include <loader.h>
ldr_module_t load(
char∗file_pathname,
ldr_load_flags_t load_flags);

PARAMETERS

file_pathname
Specifies the pathname of the object module to be loaded.

load_flagsSpecifies options on the load.  Valid values are:

LDR_NOFLAGS
No flags are specified.

LDR_NOINIT
Do not run initialization routines.

LDR_NOUNREFS
Allow no unresolved references after resolving shared library references.

LDR_PREXIST
The module must have been already loaded.

LDR_NOPREXIST
Return an error if the module is already loaded.

DESCRIPTION

The load() function loads the specified object module into the virtual address space of the calling process. 

If the object module is already loaded, the function does not load it again, but it returns its module ID unless the LDR_NOPREXST load flag is specified.  To use the LDR_PREXIST load flag, the module must already be loaded and its module ID returned. 

NOTES

The loader assigns a unique identifier to each module when it is loaded.  This identifier is called a module ID, and is defined as type ldr_module_t.  Module IDs provide a convenient way to reference loaded modules in other loader-related functions.  For example, the ldr_entry() function returns the entry point for the loaded module associated with a specified module ID. 

RETURN VALUES

Upon successful completion, a nonzero module ID of type ldr_module_t is returned.  Otherwise, a module ID of 0 (zero) is returned and errno is set to indicate the error. 

ERRORS

If the load() function fails, errno may be set to one of the following values:

[ENOEXEC]The file_pathname parameter specifies a file with a bad object file format. 

[EINVAL]The load_flags parameter specified an invalid option. 

[EEXIST]The LDR_NOPREXST load flag was specified and the module was already loaded. 

[ENOSYM]One or more unresolved external symbols were found. 

[ENOPKG]One or more unresolved package names were found. 

RELATED INFORMATION

Functions: unload(3), ldr_entry(3), ldr_lookup(3), ldr_xload(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026