Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef void (__cdecl *INITIALIZER)();
- #pragma const_seg("mydata$a")
- const INITIALIZER firstInitializer = 0;
- #pragma const_seg("mydata$z")
- const INITIALIZER lastInitializer = 0;
- void InitializeAllTheThings(const INITIALIZER * pfbegin, const INITIALIZER * pfend) {
- // if (pfbegin < pfend)
- do {
- if (const INITIALIZER initializer = *pfbegin++) initializer();
- } while(pfbegin < pfend);
- }
- void InitializeAllTheThings()
- {
- InitializeAllTheThings(&firstInitializer + 1, &lastInitializer);
- }
- void __cdecl someFunc();
- #pragma const_seg("mydata$u")
- __declspec(allocate("mydata$u")) /*const*/ INITIALIZER __x_m = someFunc;
- #pragma warning(disable : 4075) // initializers put in unrecognized initialization area
- #pragma init_seg("mydata$u")
- struct XXX {
- XXX() { someFunc(); }
- };
- //static XXX g_x;
- __pragma(comment(linker, "/include:?__x_m@@3P6AXXZEA"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement