Developing the PowerBuilder extension

PowerBuilder Native Interface

Developing the PowerBuilder extension

A PowerBuilder marshaler extension usually provides a native class that acts as a creator. This class defines a function that creates an instance of the foreign component that is specified in the parameters passed into the function (1). If it succeeds in creating an instance of the foreign component (2), it creates a proxy for it using the PBVM (3, 4), creates a marshaler object (5), and associates the marshaler with the proxy (6).

Figure 3-1: Creating a foreign component, proxy, and marshaler

pbni05.gif

When a function of the proxy object is called in PowerScript, the PBVM calls the InvokeRemoteMethod function on the marshaler object through the proxy (1, 2). The marshaler object translates PowerBuilder function calls into requests that the foreign component understands, sends the requests (3), waits for a response, and send the results back to PowerBuilder (4).

Figure 3-2: Invoking a remote method

pbni06.gif

To develop the extension, you need to:

Step 1: Describe the extension

Step 2: Implement the creator class

Step 3: Implement the marshaler class