rust/tests/run-make/native-link-modifier-whole-archive/c_static_lib_with_constructor.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
304 B
C++
Raw Normal View History

#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;