This is the robust version of C++ source code for the the external function own_func_fred

// more robust version with error checks

XPE::TOKEN own_func_fred( XPE::SREF xpe_this, int cnt, XPE::TOKEN arr[] )
{
	char buff[32];

	if (cnt != 2)
	{   return XPE::tok_error;
	}

	XPE::TOKEN
		*tok1 = &arr[0];

	if (*tok1 == XPE::tok_error)
	{	return XPE::tok_error;
	}

	int	arg1 = tok1->get_int();

	XPE::TOKEN
		*tok2 = &arr[1];

	if (*tok2 == XPE::tok_error)
	{	return XPE::tok_error;
	}

	int	arg2 = tok2->get_int();

	sprintf(buff, "xxx_%d_%d", arg1, arg2);

	return buff;
}
A more simpler (less robust) version of own_func_fred without error checks.

An example showing the XPE side of the external function call