The elements of PBNI

PowerBuilder Native Interface

The elements of PBNI

To enable the features described in the previous section, PBNI provides interfaces, structures, global functions, and helper classes. These elements are described in more detail in the reference section of this guide. See Chapter 7, "PBNI Interfaces, Structures, and Methods." This section provides an overview.

Interfaces

The IPB_VM interface is used to load PowerBuilder applications in third-party applications and interoperate with the PowerBuilder virtual machine (PBVM).

IPB_Session is an abstract interface that defines methods for performing various actions such as accessing PowerScript data, creating PowerBuilder objects, and calling PowerScript functions.

The IPB_Value and IPB_Arguments interfaces enable you to pass values between the PowerBuilder VM and PowerBuilder extension modules.

The IPB_Value interface represents a PowerBuilder value, which could be one of the PowerBuilder standard datatypes such as integer, long, string, and so forth. It provides information about each variable, including its type, null flag, access privileges, array or simple type, and reference type.

The IPB_Arguments interface represents the arguments passed to a PowerScript function and is used to access the data.

The IPB_ResultSetAccessor and IPB_RSItemData interfaces enable you to access data in a DataWindow or DataStore.

All PowerBuilder native classes inherit from the IPBX_NonVisualObject interface or the IPBX_VisualObject interface, which in turn inherit from the IPBX_UserObject interface. You must implement the Invoke method in the inherited class to enable PowerBuilder to invoke methods in the native class.

Marshaler extensions contain a class that inherits from the IPBX_Marshaler interface. You must implement the InvokeRemoteMethod method in the inherited class to enable PowerBuilder to invoke methods on remote objects represented by a proxy.

Structures

The PBCallInfo structure holds arguments and return type information for function calls between PBNI and PowerBuilder. To access the information in PBCallInfo, use the IPB_Arguments interface.

The PBArrayInfo structure stores information about arrays.

The PB_DateData, PB_TimeData, and PB_DateTimeData structures are used to pass DataWindow and DataStore data.

Global functions

Every PowerBuilder extension object must export global functions that enable the PowerBuilder VM to create instances of the object and use its methods. The PBX_GetDescription function describes the classes and functions in the extension. The PBX_CreateNonVisualObject function enables the PBVM to create instances of the nonvisual classes in an extension, and the PBX_CreateVisualObject function does the same for visual classes.

Helper classes

Several helper classes, such as PBObjectCreator, PBArrayAccessor, and PBEventTrigger, make it easier to program with PBNI.

Interaction between an extension and the PBVM

The following diagram summarizes how an extension interacts with the PBVM.

Figure 1-2: Interaction between an extension and the PowerBuilder VM

pbni02.gif