[Lazarus] Weird object variables access [SOLVED] - Delphi mode bug!

Sven Barth pascaldragon at googlemail.com
Wed Oct 25 14:17:49 CEST 2017


Am 25.10.2017 13:06 schrieb "Giuliano Colla via Lazarus" <
lazarus at lists.lazarus-ide.org>:

With older Delphi's up to, I believe, Delphi 7 you have that:

1) the syntax for the assignment of a procedural type is @ProcIdentifier :=
whatever;

2) If whatever is a pointer, and ProcIdentifier is a Method, the data field
is left untouched

This made it possible, with some dirty tricks to build a proper method
procedural type.


You're relying on implementation details which now often than not is an
accident waiting to happen.
If you want to play around with the data pointer of a method pointer then
cast it to TMethod which a record with a code and data pointer and is the
documented way for this.

In recent Delphi's (someone tested with X7, I did with X10)

1) The syntax @ProcIdentifier := whatever is no more valid. It's no more
possible to assign a pointer to a method type without typecasting.


Probably for good reason.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171025/8782d4a4/attachment.html>


More information about the Lazarus mailing list