
global variable in shared library.
Hello,
I have encounted a problem that, when a global variable is declared in shared
library, if the application using that library has the same variable name, but
with different size ( for example, in library, I declared 'char myname[256]'
and in the application, I delcared 'char myname[128]'). The application _may_
crash during termination.
What is the rule of using global variable in a shared library? I was doing
mostly Win32 application and it is not a problem as all as the global variable
in a DLL is tight in the DLL address space only. It is not visisble to the
process unless you explicitly put into a shared memory region.
TIA.
- Wong