Open System Services Programmer's Guide
New pragma Directives
There is limited support for the combining of modules compiled with different data models into a
single loadfile. This feature is specifically limited to code that is intended for a data-model-neutral
DLL. This feature is not allowed for user-level applications. It is the programmer's responsibility to
insure that declarations and definitions are consistent between separately compiled modules that
are to be combined. Two new pragmas are provided to aid in this.
NOTE: No link-time support is available that detects potential mismatches.
#pragma p32_shared
The new #pragma p32_shared pragma applies to class, struct, or union definitions. It indicates
that within the definition, unqualified pointer declarations are 32 bit pointers—regardless of the
data model. For C, this only affects pointers declared as fields. For C++, this also applies to pointers
declared (implicitly or explicitly) for member function parameters (including the implicit this
parameter) and for any pointers used in class and member function definitions.
It also disallows components whose layout or size are not data-model invariant. This means that
long is disallowed as a component. Any class, struct, or union component must be declared as
either p32_shared or p64_shared. Any base class of a p32_shared class must also be a
p32_shared class.
#pragma p64_shared
The new #pragma p64_shared pragma applies to class, struct, or union definitions. It indicates
that within the definition, unqualified pointer declarations are 64 bit pointers—regardless of the
data model. For C, this only affects pointers declared as fields. For C++, this also applies to pointers
declared (implicitly or explicitly) for member function parameters (including the implicit this
parameter) and for any pointers used in class and member function definitions.
It also disallows components whose layout or size are not data-model invariant. This means that
long is disallowed as a component. Any class, struct, or union component must be declared as
either p32_shared or p64_shared. Any base class of a p64_shared class must also be a
p64_shared class.
Mixed Data-Model Prototypes in cextdecs.h
For the cextdecs.h file, only prototypes that are supported for mixed data-model use (for example,
a 32-bit process using 64-bit pointers) have pointers with the _ptr64 modifier. Most cextdecs.h
prototypes do not have mixed data-model support, and their unqualified pointers default to the
pointer width for the data model used at compile time—either ILP32 or LP64.
NOTE: Procedures not modified to support 64-bit pointers (for example, the DEFINESAVE
procedure) have _ptr32 in their prototypes.
Mixed Data-Model Programming Example
The following code is an example of mixed data-model programming. This code is an example of
a 64-bit application needing to call a routine that is a 32-bit-only API. The prototype declarations
have been extracted from cextdecs.h.
300 64-Bit Support in OSS and Guardian










