M$ALLOC
The M$ALLOC library routine dynamically allocates memory.
Syntax:
 CALL "M$ALLOC" USING memSize
                      memAddress
Parameters:
memSize
any numeric data item or numeric literal
Specifies the number of bytes to be allocated.
memAddress
USAGE HANDLE
Receives the handle to the allocated memory. If the allocation fails the this item is set to NULL.
 
Note - for compatibility reasons this item may also be defined as USAGE POINTER. In this case the program must be compiled either with -ca or -cp options. With -ca POINTER is translated to HANDLE. With -cp POINTER is a real pointer that can be shared with external C routines.
Examples:
Example - Allocate 8 bytes of memory on each handle and put the words Hello World in them
*> define mem1 and mem2 usage handle
 
call "m$alloc" using 8, mem1
call "m$alloc" using 8, mem2
call "m$put" using mem1, "Hello"81
call "m$put" using mem2, "World"81