Yesterday I downloaded the latest Win32 binaries, installed them and
tried
my first "hello sab" program, consisting of this simple line:
SablotProcess("one","two","three",0,0,&result);
This, of course, was expected to return an error, but instead of that,
it simply
crashed. After much messing around I took a look at the source code, and
found that SablotProcess reduces to:
int lSablotProcess(char *sheetURI, char *inputURI, char *resultURI,
char **params, char **arguments, char **resultArg)
{
void *theproc;
EE( SablotCreateProcessor (&theproc) );
EE_D( SablotRunProcessor(theproc,
sheetURI, inputURI, resultURI,
params, arguments), theproc );
EE_D( SablotGetResultArg(theproc, resultURI, resultArg), theproc );
EE( SablotDestroyProcessor(theproc) );
return 0;
};
The problem then is immediately spotted to be with EE_D macro
#define EE_D(CODE,PROC) {if (CODE) {SablotDestroyProcessor(PROC); return
CODE;}}
when apply to SablotRunProcessor(...), if there's an error EE_D destroys
the processor and then *reinvokes* SablotRunProcessor(), which produces
the crash. Instead, EE_D should have been defined as:
#define EE_D(CODE,PROC) {int code___=(CODE);if (code___)
{SablotDestroyProcessor(PROC); return code___;}}
Has anybody meet this problem? It looks so surprisingly simple that I'm
not
sure yet I'm missing some obvious point.
Regards,
Joaqu�n M� L�pez Mu�oz
Telef�nica, Investigaci�n y Desarrollo