kubo / plthook

Hook function calls by replacing PLT(Procedure Linkage Table) entries.
745 stars 152 forks source link

ssize_t rv was not decleared #36

Closed skeyvin closed 2 years ago

skeyvin commented 2 years ago
#include "plthook.h"

ssize_t recv(){
ssize_t rv = main();
return rv;
};

int main(){
    plthook_t *hook;
    plthook_open(&hook, "vulkan.elf");
   recv();

};

i compile it with g++ main.cpp and on the vulkan.elf i have everything in extern "C"{} all plhook stuff is in the same directory as main.cpp how do i solve this? compiler error =

main.cpp: In function ‘ssize_t recv()’:
main.cpp:12:14: error: ‘main’ was not declared in this scope
   12 | ssize_t rv = main();
      |              ^~~~
kubo commented 2 years ago

The error itself is solved if int main(void); is added before ssize_t recv(){. But even though it is solved, your code is useless. It calls main() and recv() alternately until the process crashes.