Programmer's Reference

Pascal16 and cdecl16 PlatformFunctions

IBM Smalltalk supports an extra PlatformFunction calling convention known as pascal16 and cdecl16 on the OS/2 and Windows platforms. This convention allows users to call functions in 16-bit DLLs. The creation and calling syntax is identical to the 32-bit syntax, but the type conversions are performed differently.

16-bit PlatformFunctions convert and push char, bool, int8, int16, uint8, and uint16 as 16-bit values. pointer, object, struct, int32, and uint32 are converted and pushed as 32-bit values.

An example pascal16 function is:

add16: num16, and32: num32
   <pascal16: int32 'MYDLL16.DLL':add16and32 int16 int32>
   ^self primitiveFailed

The equivalent C function would look like:

long FAR PASCAL add16and32(num16, num32)
{
  return(num16 + num32);
}

An example cdecl16 function is:

add16: num16 and32: num32
   <cdecl16: int32 'MYDLL16.DLL':_add16and32 int16 int32>
   ^self primitiveFailed

The C function would look like:

long FAR _cdecl add16and32(int num16, long num32)
{
return(num16 + num32);
}

All 16-bit functions must be declared FAR and exported from their DLL. PlatformFunction objects can also be created using the pascal16 and cdecl16 calling conventions.

Note:
On OS/2, all FAR PASCAL functions are exported as uppercase. The IBM Smalltalk code must use an uppercase name to refer to these functions. _cdecl functions prepend an underscore to the name. The Smalltalk code must specify the underscore when calling these functions.

The calling convention C16 is an alias for pascal16 and will be removed in future releases.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]