Removing Native Entry Points

“Entry Points to P-Code Functions” describes the entry points that allow p-code functions to be called from functions compiled into machine language. The native entry point of a p-code function is, on average, six bytes long. If you have p-code functions that are called only by other p-code functions, you can omit those entry points and save those bytes by using the /Gn compiler option.

You can also control the removal of native-code entry points from within your source code by using the native_caller pragma. The native_caller pragma takes an on/off argument and works on a function-by-function basis. To turn off native entry-point code generation for a p-code function, enter

#pragma native_caller (off)

above the definitions of those p-code functions that are only called from other p-code functions. After the definitions of those functions, turn the native_caller pragma back on by entering

#pragma native_caller (on)

To reset the native_caller pragma to the value entered on the command line, include the pragma without a parameter:

#pragma native_caller ()

When optimizing native entry sequences, bear in mind that all p-code functions that are exported, called via function pointers, or defined as _loadds require native entry points. This includes Windows call-backs.

Warning!:

If you execute a program where a machine-language function calls a p-code function without a native entry point, your program will terminate abnormally. In most cases, the Make P-Code utility (MPC) can detect when a p-code function is missing a required native entry code sequence.