help-octave
[Top][All Lists]
Advanced

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

Re: loadlibrary... again


From: Michael Goffioul
Subject: Re: loadlibrary... again
Date: Thu, 21 Nov 2013 11:48:43 -0500

On Thu, Nov 21, 2013 at 11:44 AM, marcimatz <address@hidden> wrote:
Thank you for your reply Michael,

Maybe my question was formulated in a too complicated way:

Between individual calls to a shared library function, will variables and
reserved resources be maintained?

If one of my shared library API function is:

xxx_incrementAndPrint()
{ // this is a C function inside of my shared library
    static int variable1=0;
    variable1++;
    printf("variable1=%i\n",variable1);
}

and I call that function via an oct file, within Octave:

oct_incrementAndPrint()
oct_incrementAndPrint()
oct_incrementAndPrint()

will the result be:

variable1=1
variable1=1
variable1=1

or

variable1=1
variable1=2
variable1=3

?

The best is to try it out :)

But I believe the actual result will be the second one. If you "clear" the function table, then it should unload the library, and reload it on the next call. So your internal counter would then restart from 1.

Michael.


reply via email to

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