Vensim provides a simple function to send error messages to the user. This again can be called via the function pointer in VENGV
void (VEFCC *error_message)(int severity,unsigned char *str) ;
or by linking with vensim.lib and calling:
void VEFCC vensim_error_message(int severity,char *str) ;
severity - the importance of the message. It should be one of WARNING (3), VERROR (5) or STOP (8). These constants are defined in vensim.h.
str - a string containing the message to send. STOP messages result in a dialog box being displayed. VERROR and WARNING messages are displayed in the simulation error log.
int (VEFCC *execute_curloop)(void) ;
or by linking with vensim.lib and calling:
void VEFCC execute_curloop)(void) ;
This is used in functions that are marked as needing to solve a simultaneous loop involving the LHS variable and the arguments to the function. You signal Vensim that you have a function requiring loops by passing a modify argument value of 2 during the call to user_definition. .
To determine a variable name from an offset (available when values are passed as vectors by subtracting VENGV->LEVEL from (v->vals+index)) use the varname_from_offset function:
int (VEFCC *varname_from_offset)(unsigned offset,unsigned char *buf,int maxbuflen) ;
Unlike the varname passed in the vector argument this will give you the complete set of subscript values. Note that the offset is 0 based. This is different from the offset returned by get_varoff which is 1 based. To use an offset returned from get_varoff in varname_from_offset you would need to subtract 1.
There are also a series of functions available via the callback mechanism that behave exactly as their counterparts in the Vensim DLL. These are:
int (VEFCC *get_val)(const char *name,float *val) ;
int (VEFCC *get_dpval)(const char *name,double *val) ;
int (VEFCC *get_vecvals)(const unsigned long *vecoff,float *vals,int nvals) ;
int (VEFCC *get_dpvecvals)(const unsigned long *offsets,double *dpvals,int veclen) ;
unsigned (VEFCC *get_varoff)(const char *varname) ;
int (VEFCC *check_status)(void) ;
int (VEFCC *get_varnames)(const char *infilter,int vartype,char *buf,int maxbuflen) ;
int (VEFCC *get_varattrib)(const char *varname,int attrib,char *buf,int maxbuflen) ;
int (VEFCC *get_info)(int infowanted,char *buf,int maxbuflen) ;