On 09.12.2013 18:06, Leonardo M. Ramé wrote:
Hi, I'm passing a pointer buffer as void * to a C library that returns
Uint8 or Uint16 (and signed types).
If I explicitly declare the buffer as PByte, PWord, etc. I get exactly
what I need, but, I would like to work with an abstract type (for
example Pointer) and cast it depending on a flag returned by the
library.
If I pass a Pointer (instead of a PWord or PByte) and cast it to PWord,
for example. I get the same result if I have passed a PByte.
How can I handle a situation like this without explicitly define each
type?.
Regards,
PPointerCast=^TPointerCast
TpointerCast=record
case integer of
0:(pb:PByte);
1:(pw:PWord);
2:(pd:PDword);
3:(pu:PtrUint);
4:(pi:PtrInt);
end;
function some_function(ptr:TPointerCast):boolean;
regards,
Anton
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus