A
Allen
In a static library, there is a static variable definition.
static CLogger::mapFile;
In both EXE and DLL, I use the same code. CLogReader uses
CLogger::mapFile to do some work.
CLogReader logReader;
But the result is different.
When used in EXE, mapFile constructor is not called? (Why?). See EXE
log below.
Creating map file 0x00499f90 (call CMapFile constructor)
Enter CLogReader now ...
GetMapFile 0x00499f90 ... (return the static mapFile)
Exit CLogReader now ...
When used in DLL, mapFile constructor is called, but after the first
use. See DLL log below
Enter CLogReader ...
GetMapFile 0x10025830 ... (return the static mapFile)
Exit CLogReader ...
Creating map file 0x10025830 (in CMapFile constructor)
It is too strange to understand. Why???
static CLogger::mapFile;
In both EXE and DLL, I use the same code. CLogReader uses
CLogger::mapFile to do some work.
CLogReader logReader;
But the result is different.
When used in EXE, mapFile constructor is not called? (Why?). See EXE
log below.
Creating map file 0x00499f90 (call CMapFile constructor)
Enter CLogReader now ...
GetMapFile 0x00499f90 ... (return the static mapFile)
Exit CLogReader now ...
When used in DLL, mapFile constructor is called, but after the first
use. See DLL log below
Enter CLogReader ...
GetMapFile 0x10025830 ... (return the static mapFile)
Exit CLogReader ...
Creating map file 0x10025830 (in CMapFile constructor)
It is too strange to understand. Why???