c++ - Static Global Fields in a Shared Library - Where do they go? -


I have a CPP file from which I am creating a shared library (autofoo and so on). In the CPP file, I have declared some static fields which I use in full library work.

My question is 2-part:

1) Where are they remember? It is not that the system provides the entire library immediately and keeps it in memory ... The library is, in fact, only a bunch of hooks.

2) Is there a better way to do this? The reason for this is that I did it to start that I want to save the user from the need to pass the fields as parameters in every library function call.

Thanks

Generally (there are minor technical differences in each): < / P>

  • Loads shared loads: div class = "text-mail" itemprop = "text">

  • Also launches global static members using their constructor.

Note: The shared Lib loader does not have to do this at all load points.
It can make some of these work lazy (implementation details). But they will be used before use.

Any Global Stack POD Variable (things without any constructor) Special Memory Segment will be stored on the basis of the weather, whether or not they have been initialized (again an implementation description). If they have already begun, they will already be loaded with a set price (or shared lib creation) with the set price.

Then answer your questions:

  • Undefined.
  • Initial Data Segment
  • Initial Data Segment
  • Some utility code which knows how it's running the application.
  • In fact,
    • Better practice will suggest passage of values ​​in a function rather than depending on the global condition. But honestly, this is a generalization and actually under the problem.

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -