Friday, December 13, 2013

The main program and dynamic libraries shared global variable problem


Global variable defined in a static libraryDynamic libraries are used in the main program and the static library
The main program will be loaded when initializing static global variable
libraryDynamic library to access the global variable is empty when
How to make a dynamic library proper access to the main program that initializes the global variables

Do not pass a value to be loaded when the dynamic library

ps: iphone not discussed here can be approved with a dynamic library problems, only run on jailbroken loom.
Reply:
Look static usage of your project meets the specific analysis
Reply:
If the program is already running, a static library is already initialized global variables, and how will be empty?

You have to determine the dynamic library is loaded when the program is running it? Still in the beginning of the program, did not finish loading the data (including static library global variables),
Dynamic libraries began to read the data of static library?

Reply:
Runtime initialization variable

Program is running is no problem using this variableWhen the dynamic loading dynamic libraries, dynamic libraries which then access this variable is empty, the main program or normal access

No comments:

Post a Comment