rust/tests/run-make/native-link-modifier-whole-archive/c_static_lib_with_constructor.cpp
2023-01-11 09:32:08 +00:00

12 lines
304 B
C++

#include <cstdio>
// Since this is a global variable, its constructor will be called before
// main() is executed. But only if the object file containing it actually
// gets linked into the executable.
struct Foo {
Foo() {
printf("static-initializer.");
fflush(stdout);
}
} FOO;