Hello All
When creating a windows DLL you had to export global symbols (either via
the keyword "dllexport" or via command line parameter "-rdynamic").
This works fine for functions and global variables that are preinitialized.
But uninizalized variables are not exported (i.e. "int a = 1;" works
while "int a;" does not work).
The reason is, that "pe_build_exports()" in tccpe.c contains the
following check to filter all symbols that shall be exported:
if ((sym->st_other & ST_PE_EXPORT)
/* export only symbols from actually written sections */
&& pe->s1->sections[sym->st_shndx]->sh_addr) {
The second condition of this if statment is the reason for the bug, as
uninitialized variables do not
have a corresponding address in a PE-section (they are generated
dynamicially on startup).