Peek & poke from/to a MemoryBlock

Can anyone tell me why I can’t get function pointer to get/set values of a MemoryBlock. Thanks

REALobject mb = NULL;

mb = REALnewInstanceWithClass(memoryblockRef);
if (!mb)
   return NULL;

typedef void (*setByte)(REALobject obj, RBInteger offset, unsigned char val);
setByte mbSetByte = (setByte)REALLoadObjectMethod(mb, "Byte(offset As Integer, Assigns val As UInt8)");
typedef RBInteger (*getByte)(REALobject obj, RBInteger offset);
getByte mbGetByte = (getByte)REALLoadObjectMethod(mb, "Byte(offset As Integer)");

if ((!mbGetByte) || (!mbSetByte))
    return mb; // return NULL ??????
REALSetPropValueInteger(mb, "Size", bufSize);


Please read older thread first

Thanks Christian. Invaluable help as usual.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.