On Fri, 10 Feb 2012, Allin Cottrell wrote:
You should call libgretl_init() exactly once in your
program, before calling other gretl functions. And you
should call libgretl_cleanup() exactly once also, once you
have finished using the library.
That was a bit terse, let me explain a little:
* libgretl_init() allocates memory for various things needed
by libgretl. If you call it more than once your program will
leak memory.
* libgretl_cleanup() tears down everything to do with
libgretl. If you try calling libgretl functions after doing
the cleanup you'll get a big mess: in fact, the expected
result is that your program crashes.
This is pretty standard for complex shared libraries: there's
some sort of setup function and some sort of cleanup function,
each of which should be called only once in any given program.
Allin Cottrell