简体   繁体   English

编码时如何获得自定义函数的执行地址?

[英]How can I get my custom function execution address when coding?

Simple code, eg: 简单的代码,例如:

void* print_my_address() {
    printf("%p\n", .../* get the execution address of print_my_address */)
}

Thanks! 谢谢!

PS: gcc v4.7 Can I get the address by compiler? PS:gcc v4.7我可以通过编译器获取地址吗?

The same way you'd do it for any other regular variable: 对其他任何常规变量执行此操作的方式相同:

void print_my_address() 
{
    printf("%p\n", &print_my_address);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM