bug-libmatheval
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-libmatheval] segmentation fault using matheval


From: Ferrarese Leopoldo
Subject: [Bug-libmatheval] segmentation fault using matheval
Date: Thu, 29 Jul 2004 09:12:34 +0200

Hi,
I want use the libmatheval in a extension php under apache.
In this way I can implement a simple interface to php.

the extension is very simple:
the php give me a string and after I call a simple function:

int calcola(char* string, char* res)
{
  int length;       /* Length of above buffer. */
  void *f;          /* Evaluators for function and function derivative.  */
  double x=0;       /* Variable x value.  */
  f = evaluator_create(string);
  if (f==NULL)
     {
      res[0]='\0';
      return 0;
     }
  y=evaluator_evaluate_x (f, x);
  sprintf(res,"%f",y);
  return 1;
}

This function is very stupid, but sometime evaluator_create(string) fails!
return NULL or the function create a segmentation fault!!!
But if I call again (with same string obviously) it works fine.

why?

the lib is thread safe?

thank you very much,
Leo
----------------------------------------------------------------------
Leopoldo Ferrarese                e-mail: address@hidden
Matrix Spa                        Phone : +39 02 29047.438
C.so Garibaldi, 99                Fax   : +39 02 29047.564
IT-20121 Milano, ITALY            Web   : http://search.virgilio.it
----------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]