Low-level memory functions
Low-level memory functions are basically mostly used functions from lov-level API. It covers all memory functions such memory allocation, freeing, copying and more. Qube is 32bit desktop environment. This means you can allocate memory at one block up to 4GB. It swaps the memory and extends it by disk space if the oprating system supports this. There is a driver called cwsdpmi.exe for DOS that simulates 32 bits protected interface. This is a file from DJGPP distribution you can find at www.delorie.com.
Qube supports the following low-level functions for memory manipulation :
Note : All of these functions are pointers, such all functions in Qube to be easy pre-pointing them to other functions at run-time.
l_ptr low_mem_malloc ( l_size_t size // Bytes to allocate ); l_ptr low_mem_realloc ( l_ptr old, // Pointer to previously allocated memory block l_size_t size // New size in bytes ); void low_mem_free ( l_ptr old // Previously allocated memory block to be freed ); l_ptr low_mem_calloc ( l_size_t num_elements, // Number of elements l_size_t size // Length in bytes of each element ); l_ptr low_mem_memcpy ( l_ptr dest, // New buffer cl_ptr src, // Buffer to copy from l_size_t num // Number of characters to copy ); l_ptr low_mem_memchr ( cl_ptr string, // Pointer to buffer l_int ch, // Character to look for l_size_t num // Number of characters to check ); l_int low_mem_memcmp ( cl_ptr s1, // First buffer cl_ptr s2, // Second buffer l_size_t num // Number of characters ); l_ptr low_mem_memset ( l_ptr buffer, // Pointer to destination l_int ch, // Character to set l_size_t num // Number of characters ); l_ptr low_mem_memmove ( l_ptr dest, // Destination object cl_ptr source, // Source object l_size_t num // Number of bytes of characters to copy ); void clear_type ( l_ptr ptr, // Pointer to destination l_size_t size // Number of bytes of characters to set to ZERO );void afree ( l_ptr x // Previously allocated memory block to be freed and set to ZERO );