Initialize the PBCallInfo structure

PowerBuilder Native Interface

Initialize the PBCallInfo structure

Next, get the method ID for the function you want to call and initialize a PBCallInfo structure. You pass the signature obtained in "Getting the signature of a function" to the GetMethodID function:

   // PBCallInfo contains arguments and return value
   PBCallInfo ci;

   // To call the class member function f_mult,
   // pass its signature as the last argument
   // to GetMethodID
   pbmethodID mid = session->GetMethodID(cls, "f_mult",
      PBRT_FUNCTION, "III");

   // Initialize call info structure based on method ID
   session->InitCallInfo(cls, mid, &ci);

You could use FindMatchingFunction instead of GetMethodID to get the method ID. The call would look like this, because f_mult takes two integer arguments:

   pbmethodID mid = session->FindMatchingFunction(cls,
      "f_mult", PBRT_FUNCTION, "int, int");