Hi folks.
I'm trying to put a function pointer in memory at a given address. The code I'm trying to use to do this is a slight rework of code taken from BlitzMax's PokeInt command. However, it doesn't compile and complains of some problem not being able to convert types. I can't figure out what's wrong with it? Can you help?
myfuncitonsbuf is an address in memory - a byte pointer
offset is an offset in bytes from that base address - an integer
funct1() is previously defined as a function - a function pointer
(Int Ptr(myfunctionsbuf+offset))[0]=Int(funct1) ' Something wrong with this line
I haven't used type casting much so I am a bit confused.
Please don't evaluate whether or not I should be trying to do this, I DO need to do it this way, I just need to know how to make it work. Thanks.
I wondered if maybe it's a problem because the base address of the buffer is a byte pointer and should be an integer? Or maybe I am changing to the wrong types?
Thanks for your help.
I'm trying to put a function pointer in memory at a given address. The code I'm trying to use to do this is a slight rework of code taken from BlitzMax's PokeInt command. However, it doesn't compile and complains of some problem not being able to convert types. I can't figure out what's wrong with it? Can you help?
myfuncitonsbuf is an address in memory - a byte pointer
offset is an offset in bytes from that base address - an integer
funct1() is previously defined as a function - a function pointer
(Int Ptr(myfunctionsbuf+offset))[0]=Int(funct1) ' Something wrong with this line
I haven't used type casting much so I am a bit confused.
Please don't evaluate whether or not I should be trying to do this, I DO need to do it this way, I just need to know how to make it work. Thanks.
I wondered if maybe it's a problem because the base address of the buffer is a byte pointer and should be an integer? Or maybe I am changing to the wrong types?
Thanks for your help.