📄 support.c
字号:
/*
* Copyright (C) 2004, Thejesh AP. All rights reserved.
*/
#include <jazmyn\support.h>
#include <jazmyn\const.h>
void _main()
{
//_CTOR_LIST__ is defined in the linker script
extern void (*_CTOR_LIST__)();
//constructor is a list of pointers to constructors of global objects
void (**constructor)() = &_CTOR_LIST__;
int total = *(int*)constructor; //total number of global constructors
constructor++; //increment to first constructor
while(total)
{
void (*ptr)() = *constructor;
ptr();
total--;
constructor++;
}
}
void _atexit()
{
//_DTOR_LIST__ is defined in the linker script
extern void(*_DTOR_LIST__)();
//destructor is a list of pointers to destructors of global objects
void (**destructor)() = &_DTOR_LIST__;
int total = *(int*)destructor; //first dword contains number of destructors
destructor++;
while(total)
{
void (*ptr)() = *destructor;
ptr();
(*destructor)();
total--;
destructor++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -