PBX_InvokeGlobalFunction
Description
Contains the implementation of one or more global functions used
in the PowerBuilder extension module.
Syntax
1 |
PBX_InvokeGlobalFunction(IPB_Session* pbsession, LPCTSTR functionname, PBCallinfo* ci); |
Argument |
Description |
---|---|
pbsession |
This IPB session |
functionname |
The name of the global function |
ci |
A pointer to a preallocated PBCallInfo structure |
Return value
PBXRESULT. PBX_OK for success.
Examples
This PBX_GetDescription call declares three global functions:
bitAnd, bitOr, and bitXor:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
PBXEXPORT LPCTSTR PBXCALL PBX_GetDescription() { static const TCHAR desc[] = { "globalfunctions " "function int bitAnd(int a, int b) " "function int bitOr(int a, int b) " "function int bitXor(int a, int b) " "end globalfunctions " }; return desc; } |
The PBX_InvokeGlobalFunction call contains the implementation of
the functions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
PBXEXPORT PBXRESULT PBXCALL PBX_InvokeGlobalFunction ( IPB_Session* pbsession, LPCTSTR functionName, PBCallInfo* ci ) { PBXRESULT pbrResult = PBX_OK; int arg1 = ci->pArgs->GetAt(0)->GetInt(); int arg2 = ci->pArgs->GetAt(1)->GetInt(); if (stricmp(functionName, "bitand") == 0) { ci->returnValue->SetInt(arg1 & arg2); }else if (strcmp(functionName, "bitor") == 0) { ci->returnValue->SetInt(arg1 | arg2); }else if (strcmp(functionName, "bitxor") == 0) { ci->returnValue->SetInt(arg1 ^ arg2); }else{ return PBX_FAIL; } return pbrResult; } |
Usage
Use this function in a PowerBuilder native class that uses global
functions. The function is exported from the PowerBuilder extension
module and is used to identify global functions included in the module.
Like global functions in PowerScript, global functions in PowerBuilder
extensions cannot be overloaded.
See also