Function _conCall() Foundation

Calls an Xbase++ function with parameters.

Syntax
XPPAPIRET _conCall(ContainerHandle chres, char *pszFuncName,
                    ULONG nParams, ...);
Parameters
ContainerHandle chres
Handle of a container into which the result of the function call is written.
char *pszFuncName
NULL terminated character string which has the name of the function to call.
ULONG nParams
Number of parameters to pass to the function. Note: when calling functions in the Xbase++ runtime library, all non-optional parameters must be passed.
. . .
The remaining arguments must be of the container handle type and are passed as parameters to the function. Note that since the arguments are containers, the parameters are passed by reference, not by value.
Return

Returns NULL when the function is called successfully. Otherwise an error value is returned (XPP_ERR_...). If errors occur during execution of the function, the error code block is called. Note: If the error code block causes a BREAK, the return value of _conCall() is XPP_ERR_BREAK. If the error can be rectified by the error code block, the return value is NULL.

Description

Using this function, all functions and procedures in an Xbase++ program not declared static, and all functions in the Xbase++ runtime library can be called. It is critical to pay attention to the number of parameters required by the function being called. If too few parameters are passed, a fatal error is generated and the process terminates.

Examples
/* 
Read a character by calling the function Inkey(0) 
*/ 
#include <xppcon.h> 

ContainerHandle  chnKey, chn; 
XPPAPIRET        xr; 
LONG             nKey; 


chnKey = _conNew( NULLCONTAINER ); 
chn = _conPutNL( NULLCONTAINER, 0 ); 

if (chnKey != NULLCONTAINER  &&  chn != NULLCONTAINER) 
{ 
xr = _conCall( chnKey, "inkey", 1, chn ); 
if (xr == 0) 
{ 
   xr = _conGetNL( chnKey, &nKey ); 
   if (xr == 0) 
   { 
       /* 
          Evaluates characters ... 
       */ 
   } 
} 
else 
{ 
   /* Error handling ... */ 
} 
_conRelease( chnKey ); 
_conRelease( chn ); 
} 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.