std.h and stdlib.h functions
Application Program Interface
2-511
2.30
std.h and stdlib.h functions
This section contains descriptions of special utility macros found in std.h
and DSP/BIOS standard library functions found in stdlib.h.
Macros
❏
ArgToInt.
Cast an Arg type parameter as an integer type.
❏
ArgToPtr.
Cast an Arg type parameter as a pointer type.
Functions
❏
atexit.
Register an exit function.
❏
*calloc.
Allocate and clear memory.
❏
exit.
Call the exit functions registered by atexit.
❏
free.
Free memory.
❏
*getenv.
Get environmental variable.
❏
*malloc.
Allocate memory.
❏
*realloc.
Reallocate a memory packet.
Syntax
#include <std.h>
ArgToInt(arg)
ArgToPtr(arg)
#include <stdlib.h>
int atexit(void (*fcn)(void));
void *calloc(size_t nobj, size_t size);
void exit(int status);
void free(void *p);
char *getenv(char *name);
void *malloc(size_t size);
void *realloc(void *p, size_t size);
Description
The DSP/BIOS library contains some C standard library functions which
supersede the library functions bundled with the C compiler. These
functions follow the ANSI C specification for parameters and return
values. Consult Kernighan and Ritchie for a complete description of
these functions.
The functions calloc, free, malloc, and realloc use MEM_alloc and
MEM_free (with segid = Segment for malloc/free) to allocate and free
memory.
getenv uses the _environ variable defined and initialized in the boot file
to search for a matching environment string.
exit calls the exit functions registered by atexit before calling SYS_exit.