Subject: reinitialization of global varriables in .sbss section across calls on MIPS
To: Simon Burge <simonb@netbsd.org>
From: sushant mathur <sushant.iet@gmail.com>
List: port-mips
Date: 06/17/2006 18:53:52
Hi,

i am facing one problem On MIPS-netbsd regarding reinitialization of sbss
section

If in one shared library you have some global variables and if they are
part of .sbss section
Then when any function is called in that shared library from main program
and if it update those variables then this updated should be ref elected to
the subsequent calls to any function in that shared library

But I am facing one problem if i declared some global variables and in
first call to that function I assign those variables some value ,but when i
come back from that shared library to main and then later if i call some
another functions from that library then the pointers are getting
reinitialized to the initial values.

By debugging the problem i found that all these variables are part of .sbss
sections

So is this the problem with mips that whatever variables are part of .sbss
sections, are not persisting across calls to the shared library???


Pseudo Code:
============

foo.c
=========

static int tmp=10;
int xxx() {
.....
tmp = 15;
print(tmp);
...
}

int yyy()
{

print(tmp);

}

=============
tst1.c
int main() {

call xxx();

sleep(10);

call yyy();

}
==================

output:
15
10


NOTE:please CC to me as i am not the member of this mailing list