Embedding the PBVM in a C++ application

PowerBuilder Native Interface

Embedding the PBVM in a C++ application

Many PowerBuilder users have developed sophisticated custom class user objects that handle intensive database operations or other functionality. Such objects can already be used in external applications. However, limitations on the use of some datatypes and of overloaded functions, as well as other coding restrictions, diminishes the value of this technique.

To have direct access to a custom class user object running in the PBVM, and to take advantage of PBNI functions for data access and exchange, you can load the PBVM in the C++ application, create a session, and invoke the custom class user object's functions from the external application.

Communication between the PBVM and a C++ application is based primarily on two interfaces: IPB_VM and IPB_Session.

Interacting with Java

To call Java classes from PowerBuilder, you can build a marshaler extension that invokes Java methods through JNI, as described in Chapter 3, "Creating Marshaler Extensions." You can also use JNI to allow Java to call into PowerBuilder through C or C++. For an example, see the PowerBuilder CodeXchange Web site .