Sign in

docs ILE Concepts

IBM i Interfaces and Teraspace

IBM i Interfaces and Teraspace

Interfaces that have pointer parameters typically expect tagged 16 byte (__ptr128) pointers:

  • You can call interfaces with only a single level of pointer (for example, void f(char*p);) directly using 8-byte (__ptr64) pointers since the compiler will convert the pointer as required. Be sure to use the system header files.
  • Interfaces with multiple levels of pointers (for example, void g(char**p);) ordinarily require that you explicitly declare a 16 byte pointer for the second level. However, versions that accept 8-byte pointers are provided for most system interfaces of this type, to allow them to be called directly from code that uses only 8-byte pointers. These interfaces are enabled through the standard header files when you select the datamodel(LLP64) option.

Bindable APIs for using teraspace:

IBM® provides bindable APIs for allocating and discarding teraspace.1

  • _C_TS_malloc() allocates storage within a teraspace.
  • _C_TS_malloc64() allows a teraspace storage allocation to be specified using an 8-byte size value.
  • _C_TS_free() frees one previous allocation of teraspace.
  • _C_TS_realloc() changes the size of a previous teraspace allocation.
  • _C_TS_calloc() allocates storage within a teraspace and sets it to 0.

malloc(), free(), calloc(), and realloc() allocate or deallocate single-level storage or teraspace storage according to the storage model of their calling program, unless it was compiled with the TERASPACE(*YES *TSIFC) compiler option.

POSIX shared memory and memory mapped file interfaces can use teraspace. For more information about Interprocess Communication APIs and the shmget() interface, see the UNIX-type APIs topic in the IBM i Information Center (under the Programming category and API topic).

1 The teraspace compiler option TERASPACE(*YES *TSIFC) is available from ILE C and C++ compilers to automatically map malloc(), free(), calloc() and realloc() to their teraspace versions when STGMDL(*SNGLVL) is specified.