[Gretl-devel] libgretl arma
emrahsamdan at gmail.com
Fri Feb 17 08:06:51 EST 2012
I have implemented what you have offered so far and i am very grateful to
you. But my new problem is, i am getting a model from the arma function
then i call the same function again with other parameters. However, it
gives a segmentation fault in the line where i read the native gretl data
in the second call.
Do you have any idea about the reason of this ? libgretl parts in the
function that i am calling are:
fileName = generateXML(powerResults, predictions, numberOfTuples,
santralName, queryTime); // generates an .gdt file for gretl
prn = gretl_print_new(GRETL_PRINT_STDOUT, NULL);
dset = datainfo_new();
err = gretl_read_native_data(fileName, dset); //it crashes here
Sorry for my exhaustive questions, but i really couldn't find a way out.
2012/2/10 Allin Cottrell <cottrell at wfu.edu>
> 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
> Gretl-devel mailing list
> Gretl-devel at lists.wfu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gretl-devel