g++与c++扩栈方法

时间:2023-03-09 10:05:44
g++与c++扩栈方法

g++:

 /*
* Problem:
* Author: SHJWUDP
* Created Time: 2015/8/5 星期三 15:54:42
* File Name: tmp.cpp
* State:
* Memo:
*/ const int main_stack=;
char my_stack[<<]; void MAIN() {
//your code
} int main() {
__asm__("movl %%esp, (%%eax);\n"::"a"(my_stack):"memory");
__asm__("movl %%eax, %%esp;\n"::"a"(my_stack+sizeof(my_stack)-main_stack):"%esp");
MAIN();
__asm__("movl (%%eax), %%esp;\n"::"a"(my_stack):"%esp");
return ;
}

c++:

 /*
* Problem:
* Author: SHJWUDP
* Created Time: 2015/8/5 星期三 15:54:42
* File Name: tmp.cpp
* State:
* Memo:
*/
#pragma comment(linker, "/STACK:1024000000,1024000000") int main() {
return ;
}