External language interface
VA Smalltalk interfaces with other languages through the PlatformFunction mechanism. A PlatformFunction is an object that prototypes a function in another language (C for example). The PlatformFunction identifies the shared library where the function can be found, the function's name or number, and the types of the arguments and return value, if any.
For example, to create a PlatformFunction for the MessageBox function on Windows, do the following:
messageBox :=
PlatformFunction
callingConvention: 'c'
function: 'MessageBoxA'
library: 'User32.dll'
parameterTypes: #(pointer pointer pointer uint32)
returnType: #int32.
See
Platform requirements for details about platform-specific calling conventions. The
function: parameter can be a positive
Integer or a
String. The
library: parameter is the name of the shared library where the function is stored. It can be a
String or
nil. The
parameterTypes: argument is an array of type names (see below). The
returnType: argument is a single type name.
If the library is given as
nil, the function must be a
String. The function is found 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. See
User primitive tables for details on how to add functions to the table.
Last modified date: 08/10/2017