User's Guide
As you learned in Accessing external functions, VisualAge supports calling external functions by using
objects called platform functions. A platform function (an
instance of class PlatformFunction) represents a function outside
the VisualAge environment. This chapter covers how to call external
functions using IBM Smalltalk instead of visual parts.
Generally, the process of calling an external function from IBM Smalltalk
involves the following steps:
- Create a new record wrapper class (as a subclass of
AbtForeignOSObject) to represent each parameter that will be passed
to the external function.
- Parse the C header file or COBOL copybook to identify the function
prototypes and data types described in the file. The parser stores the
resulting information in an object called an object table.
- Use an entry in the object table to generate getter and setter methods in
the record wrapper class. You can use these methods to set the
parameter value contained by the record wrapper. If the parameter is of
a compound data type, IBM Smalltalk generates getter and setter methods for
each field.
- Create an instance of the PlatformFunction class to represent
the external function you want to call.
- Create an instance of your record wrapper class and use the setter methods
to provide the input values for the function call.
- Use the PlatformFunction instance to call the external
function, passing it the record wrapper containing the input values.
- Use the getter methods of the record wrappers to retrieve the external
function's output values.
IBM Smalltalk provides classes that enable you to perform each of these
tasks.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]