, , . globals.cpp:
#include "myincludes.h"
CSomeClass someObject(432);
int global_x = 42;
int global_y = InitY();
. ( , , , " " .)
( ) .
It is better to have a function that explicitly initializes your library. Perhaps you need the application to call this function at startup or the exported library functions to call it after initialization is detected. Then initialize your global variables.
In my team, code that runs before "main" (or "DllMain") is strictly prohibited. In other words, there are no global objects. There are no functions for init globals.
source
share