In GCC compiler We can use the following code to simulate a constructor:
__attribute((constructor)) void ctor(){
printf("hello, ctor.\n");
}
int main(int, char** argv){
printf("hello, main.\n");
}
In Linux using gcc, the result is:
hello, ctor.
hello, main.
The technology is specific to gcc compiler, does MSVC provide the similar functionality?
Thanks a lot!