Run-time mocking in C?

后端 未结 4 1975
旧巷少年郎
旧巷少年郎 2021-02-08 14:20

This has been pending for a long time in my list now. In brief - I need to run mocked_dummy() in the place of dummy() ON RUN-TIME, wit

4条回答
  •  借酒劲吻你
    2021-02-08 14:51

    You can replace every function by the use of LD_PRELOAD. You have to create a shared library, which gets loaded by LD_PRELOAD. This is a standard function used to turn programs without support for SOCKS into SOCKS aware programs. Here is a tutorial which explains it.

提交回复
热议问题