|
|
От: | anonymous185 | |
| Дата: | 09.04.13 19:02 | ||
| Оценка: | 1 (1) | ||
глобальные объекты без CRT свободно юзать несколько эээ.. затруднительно
#pragma comment(linker, "/merge:.CRT=.rdata")
typedef void (__cdecl *PF)(void);
#pragma const_seg(".CRT$XCA")
const PF __xc_a = 0;
#pragma const_seg(".CRT$XCZ")
const PF __xc_z = 0;
#pragma const_seg()
#ifdef MAX_DESTRUCTOR_COUNT
int cxpf;
PF pfx[MAX_DESTRUCTOR_COUNT];
extern "C" int __cdecl atexit(PF func)
{
pfx[cxpf++] = func;
return 0;
}
void destroyterm ()
{
while (cxpf--) (pfx[cxpf])();
}
#endif//MAX_DESTRUCTOR_COUNT
void initterm()
{
const PF * ppf = &__xc_a;
while (ppf < &__xc_z)
{
PF pf = *ppf++;
if (pf) pf();
}
}