About calling PowerScript from C++ applications

If you have a PowerBuilder custom class user object that performs intensive programming that would be useful to an application that you need to write in C++, you can access the object directly from the C++ application using PBNI. You do not need to make the user object into a COM component or automation server.

To call functions on a PowerBuilder object, you can embed the PBVM in the C++ application. The C++ application must load the PBVM by loading pbvm125.dll with the Windows LoadLibrary function, get a pointer to the IPB_VM interface by calling the PB_GetVM function exported by pbvm125.dll, and create a session by calling the IPB_VM CreateSession function.The application can then create an instance of the PowerBuilder class and invoke its functions through the IPB_Session interface.

The following figure illustrates the relationship between the C++ application and the interfaces provided by the PBVM.

Figure 5-1: Embedding the PBVM in a C++ application

A rectangle on the left represents the C plus plus application and one on the right represents the P B V M. The P B V M contains P B _ V M (  ). Arrows pointing from the C plus plus application to the P B V M have circles labeled I  P B _ V M, I P B _ Session, I P B _ Value, and I P B _ Arguments.