c++ - Linking against hard-coded function pointer -


i know particular function known signature located @ known address. how initialise function pointer in c++?

i have tried following (and many variations thereof) no avail:

int (*functionname)(int arg1, long arg2, char *arg3) = (int (*functionname)(int arg1, long arg2, char *arg3))0xcake; 

i have feeling expression on right hand side causing troubles, code compile if initialised 0x0 / null. pointers? (pun intended).

aside fact cake not proper hex value because k not valid hex character, plus issues different pointer types main error functionname variable not type.

it doing

px = (px)0xbadface;

where px regular pointer

if remove functionname on right leaving rest may work easier typedef.

typedef int( *functype)(int arg1, long arg2, char * arg3 ); functype functionname = (functype)(0xcafe); 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -