Compiler Option for 16-Bit Declarations (OS/2)

IBM C and C++ Compilers provides the /Gt compiler option to enable data to be shared between 32-bit and 16-bit code. When you compile a program with /Gt+, an implicit #pragma seg16 directive is performed for all variable declarations. Pointers are not implicitly qualified with _Seg16; you must qualify them if desired.

The /Gt option also defines special versions of the malloc family of functions that return memory that can be safely used by 16-bit code. When tiledmemory is specified, all calls to calloc, malloc, realloc, and free are mapped to _tcalloc, _tmalloc, _trealloc, and _tfree respectively.

These functions work exactly like the original functions, but the memory allocated or freed will not cross 64K boundaries. The objects declared can be used in 16-bit programs. This memory is also called tiled memory and is limited to 512M per process.

Note: When you use the tiledmemory option, data items larger than 64K in size will be aligned on 64K boundaries, but will also cross 64K boundaries.



Tiled Memory Management Functions


Declare Shared Objects


Preprocessor Directives
#pragma seg16