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

Shown are five rectangles representing P B V M, Creator Native Class, Foreign Component, Marshaler, and Proxy. Arrows labeled 1 through 6 represent the interactions described by the text that precedes the illustration.

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

Shown are four rectangles representing P B V M, Foreign Component, Marshaler, and Proxy. Arrows labeled 1 through 4 represent the interactions described by the text that precedes the illustration.

To develop the extension, you need to:

Step 1: Describe the extension

Step 2: Implement the creator class

Step 3: Implement the marshaler class