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 2 3 4 |
// Set IN arguments. The prototype of the function is // integer f_mult(integer arg1, integer arg2) ci.pArgs-> GetAt(0)->SetInt(123); ci.pArgs-> GetAt(1)->SetInt(45); |
Finally call the function, wrapping it in a try-catch statement
to handle any runtime errors:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
// Call the function try { session->InvokeObjectFunction(pbobj, mid, &ci); // Was PB exception thrown? if (session->HasExceptionThrown()) { // Handle PB exception session->ClearException(); } } catch (...) { // Handle C++ exception } // Get the return value and print it to the console pbint ret = ci.returnValue->GetInt(); fprintf(stderr, "The product of 123 and 45 is %i ", ret); |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest