0

I was wondering how I can get a function pointer to the openat function?

I tried the following for printf and it works but there is an error for openat.

char *getptr = (char *)openat;
Address of overloaded function 'openat' does not match required type 'char'

I am converting it to char * so that I can print the first few bytes of the function code in memory.

What should be the correct way to write the code?

This is done in an Android Studio project with native code.

EDIT

This question is slightly different from the other post (C++ address of overloaded function) because while trying to get a function pointer to openat, I encountered these issues in Android Studio as well.

int (*getptr2)(int, const char *, int, mode_t) = openat;
Address of overloaded function 'openat' does not match required type 'int (int, const char *, int, unsigned short)' 

candidate address cannot be taken because parameter 2 has pass_object_size attribute 

candidate address cannot be taken because parameter 2 has pass_object_size attribute

I am not sure what the error means.

localacct
  • 611
  • 5
  • 13

0 Answers0