dormky 2 Posted August 16, 2023 I'm trying to use TValue.Make with a pointer. Unfortunately, "myPointer as PByte" is apparently not valid Delphi code (E2015 Operator not applicable to this operand type). "myPointer as Integer" and "myPointer" alone aren't valid either. How can I tell Delphi to treat my pointer as just a number ? Basically, I need to do pointer arithmetic so as to give the correct address to TValue.Make. Share this post Link to post
Alexander Sviridenkov 357 Posted August 16, 2023 Use NativeUInt(Pointer) Share this post Link to post
dormky 2 Posted August 16, 2023 (edited) NativeUInt(Pointer) doesn't work. "NativeUInt(myPointer)" doesn't give the same number as "PByte(myRecord)", despite "myPointer" being the same value as "@myRecord". Strangely, "PNativeUInt(myRecord)" isn't valid but "PByte(myRecord)" is, wtf ? Edited August 16, 2023 by dormky Share this post Link to post
David Heffernan 2345 Posted August 16, 2023 No idea what type myPointer is. A simple 10 line program would reveal all. Share this post Link to post
David Heffernan 2345 Posted August 16, 2023 To cast to PByte then it's PByte(myPointer) Share this post Link to post