An Example Wrapper Function
As an example of a breve function wrapper around an existing function, imagine a function with the following prototype:
char *downloadURL(char *url, int timeout);
The wrapper function in breve will need to extract the url and timeout arguments from the arguments array, call the function, and store the resulting string in the structure pointed to by result. Here's how the wrapper function might look.
int breveDownloadURL(brEval *arguments, brEval *result, void *instance) {
char *url, *urlData;
int timeout;
url = BRBRRING(&arguments[0]);
timeout = BRINT(&arguments[1]);
urlData = downloadURL(url, timeout);
result->set( urlData );
return EC_OK;
}
