Call the PowerBuilder function
Before you call the function, you must supply the integers
to be multiplied. For the sake of simplicity, the following code
sets them directly in the PBCallInfo structure.
|
1 |
   // Set IN arguments. The prototype of the function is<br>   // integer f_mult(integer arg1, integer arg2)<br>   ci.pArgs-> GetAt(0)->SetInt(123);<br>   ci.pArgs-> GetAt(1)->SetInt(45); |
Finally call the function, wrapping it in a try-catch statement
to handle any runtime errors:
|
1 2 |
   // Call the function<br>   try<br>   {<br>      session->InvokeObjectFunction(pbobj, mid, &ci);<br> <br>      // Was PB exception thrown?<br>      if (session->HasExceptionThrown())<br>      {<br>         // Handle PB exception<br>         session->ClearException();<br>      }<br>   }<br>   catch (...)<br>   {<br>      // Handle C++ exception<br>   }<br> <br>   // Get the return value and print it to the console<br>   pbint ret = ci.returnValue->GetInt();<br>   fprintf(stderr, "The product of 123 and 45 is %i ",<br>      ret); |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest