> > Hi... > > On Thu, Jun 17, 2010 at 13:34, rahul patil > <[email protected]> wrote: > > Hello all, > > > > My question is simple. Is it allowed to declare global variables in > shared > > libraries? if not why ? and if yes then are there drawbacks > > of using such global variables? > > Hi,
http://en.wikipedia.org/wiki/Reentrant_%28subroutine%29 A computer program <http://en.wikipedia.org/wiki/Computer_program> or routine <http://en.wikipedia.org/wiki/Subroutine> is described as *reentrant * if it can be safely called again before its previous invocation has been completed (i.e it can be safely executed concurrently<http://en.wikipedia.org/wiki/Concurrency_%28computer_science%29> ). To be reentrant, a computer program<http://en.wikipedia.org/wiki/Computer_program>or routine <http://en.wikipedia.org/wiki/Subroutine>: - Must hold no static <http://en.wikipedia.org/wiki/Static_variable> (or global) non-constant data. - Must not return the address to static (or global) non-constant data. - Must work only on the data provided to it by the caller. Regards, Pannaga Bhushan > Not really a kernel related question, I suppose? > > But anyway, I think the reason not declaring global variable (or at > least avoiding it) is to avoid symbol conflict. Since libraries and > the process that links to them operate in the same name space, the > chance we get we get symbol conflict between them is fairly high IMO > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer and consultant > > blog: the-hydra.blogspot.com > training: mulyaditraining.blogspot.com > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to [email protected] > Please read the FAQ at http://kernelnewbies.org/FAQ > >
