On 05.06.2012 16:02, Kostas Michalopoulos wrote:
On 5/6/2012 9:29 πμ, Mattias Gaertner wrote:
The "is" operator requires that the library uses the VMTs of the main
application.
What does that imply exactly? I made a quick app to test the possibility
of using DLLs for plugins. Both the app and the DLL uses a unit that
contains the following class:
[...]
Why exactly the "is" operator fails and how can it be fixed? And how
will all the above work under Windows, Linux and Mac OS X?
If you use a unit in a library and a program the VMTs (Virtual Method
Table) of the classes in that unit are available in both the program and
the library as well. An object instance (and class type as well) is
basically identified by its VMT pointer. Now if the library uses an "is"
on a object instance passed from the program the VMT pointer the library
expects and what the code behind "is" discovers will be different and
thus the two objects will be different even if they come from the same
source unit.
The only solution for this will be dynamically loadable packages as
described here: http://wiki.freepascal.org/packages
No one is currently working on an implementation of this though and it
also isn't a high priority item so it will take quite some time until
this is implemented (if ever).
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus