Programmer's Reference

PlatformFunction protocols

The address of a PlatformFunction is not looked up until required (for example, when calling it). Looking up the address is referred to as binding. A PlatformFunction can also be unbound by the system, meaning that it must be bound again before being called.

Instance methods: accessing

The get methods are listed below. For every get method, there is a corresponding set method.

address
Answers the address (a positive Integer) of the receiver. If the receiver is not already bound, bind it. If the binding fails, a walkback occurs.

callingConvention
Answers the calling convention (a Symbol) of the receiver.

functionNumber
If the receiver is a numbered function, answers the number (a positive Integer). Otherwise, answers nil.

library
If the receiver resides in a shared library, answers the appropriate PlatformLibrary object. Otherwise, answers nil.

name
If the receiver is a named function, answers the function name (a String). Otherwise, answers nil.

parameterTypes
Answers an array of the receiver's parameter types (Symbols).

returnType
Answers the Symbol describing the return type of the receiver.

Instance methods: calling

call
Calls the receiver and answers the result of the call. If the return type is void, answers the receiver. If the receiver cannot be bound or a parameter cannot be converted, a walkback occurs.

callWith:
Calls the receiver with the given arguments. Answers the result of the call. If the return type is void, answers the receiver. If the receiver cannot be bound or a parameter cannot be converted, a walkback occurs.

callWith:with:
Calls the receiver with the given arguments. Answers the result of the call. If the return type is void, answers the receiver. If the receiver cannot be bound or a parameter cannot be converted, a walkback occurs.

callWith:with:...with:
Calls the receiver with the given arguments. The maximum number of arguments is 32. Answers the result of the call. If the return type is void, answers the receiver. If the receiver cannot be bound or a parameter cannot be converted, a walkback occurs.

Class methods: instance creation

callingConvention:function:library:parameterTypes:returnType:
Answers a new PlatformFunction with the given parameters. The callingConvention: must be a string or symbol. The function: can be a positive Integer or a String. The library: is the name of the shared library where the function is stored. It can be a String or nil. parameterTypes: is an array of type names (Strings or Symbols). The returnType: is a single type name (a String or Symbol).
Note:If the library is given as nil, the function must be a String. The function is looked up in the user primitive table instead of in a shared library. The String is the name of the user primitive. The function that is called is not a user primitive; it is a normal C function.

callingConvention:address:parameterTypes:returnType:
Answers a new PlatformFunction with the given parameters. The callingConvention:, parameterTypes:, and returnType: are the same as above. The address: is a positive Integer. Use this method to create a PlatformFunction for a function that is not in a shared library but whose address is available by some other means (for example, returned by an operating system call). A PlatformFunction created in this manner has its address set to zero when the image starts.

Calling Convention OS/2 Windows 95/98 Windows NT UNIX
'c' __stdcall __stdcall __stdcall (none)
'pascal16' _Far16 _Pascal __far __pascal

'pascal' _Pascal


'cdecl16' _Far16 _Cdecl __far __cdecl

  • 'abtSystem' and 'abtC32' are obsolete synonyms for 'c'.
  • 'c16' and 'abtsystem16' are obsolete synonyms for 'pascal16'.
  • 'abtpascal32' is an obsolete synonym for 'pascal'.
  • 'abtc16' is an obsolete synonym for 'cdecl16'.


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