Pointing a function pointer to a variable?
Hi, all :)
How do you “point” a function pointer to an array of byte code? I have converted a series of assembly instructions to byte codes (I don’t want to use inline assembly), and want my function pointer to point to that array of byte codes. The problem is that the VC++ compiler won’t cast from chars to the defined function pointer. The following code might explain better:
Code:
int (* FuncPtr)(int x, int y); // the function pointer
char ByteCode[] = {...}; // the byte code array
FuncPtr = ByteCode; // point the function pointer to the byte code array
The problem is that VC++ won’t covert from char array to the function definition. I tried adding “(void *)” when pointing but it still wouldn’t convert. :(