Load the PowerBuilder VM

In your C++ development tool, create a new console application project. The include directory for the PBNI SDK, typically PowerBuilder 12.5\SDK\PBNI\include, must be in your include path. If you use any helper classes, the source file that contains them must be added to your project. For a list of files and helper classes, see the table in “The PBNI SDK”.

The code for the C++ application creates an IPB_VM object using the PB_GetVM function and loads the PowerBuilder VM:

#include "pbext.h"
#include "stdio.h"

typedef PBXEXPORT PBXRESULT (*P_PB_GetVM)(IPB_VM** vm);

int main(int argc, char *argv[])
{
   IPB_Session* session;
   IPB_VM* pbvm = NULL;

   //Load the PowerBuilder VM module
   HINSTANCE hinst = LoadLibrary("pbvm125.dll");
   if ( hinst== NULL) return 0;
   fprintf(stderr, "Loaded PBVM successfully\n");