Is there a compiler feature to inject custom function entry and exit code?

后端 未结 4 1818
无人及你
无人及你 2020-12-10 15:19

Currently coding on Windows with VS2005 (but wouldn\'t mind knowing if there are options for other compilers and platforms. I\'m most interested in OSX as an alternative pl

4条回答
  •  Happy的楠姐
    2020-12-10 15:31

    OpenWatcom C and C++ compilers have -ee and -ep parameters for that:

    -ee           call epilogue hook routine
    -ep[=]   call prologue hook routine with  stack bytes available
    

    They will cause the compiler to emit calls to __EPI and __PRO user-defined hook routines.

    There is also

    -en           emit routine names in the code segment
    

    that will emit the function name into the object code as a string of characters just before the function prologue sequence is generated. May be useful for the __PRO routine.

    More information in these and other compiler options can be found in the C/C++ user guide available among other manuals at http://openwatcom.org/index.php/Manuals

提交回复
热议问题