[fpc-devel] Suggestion regarding dynamic packages
max.vlasov at gmail.com
Sun Nov 21 13:49:51 CET 2010
I recently read the info about current implementation of packages and a post
that dynamic packages support is at the early stage or not started yet.
Knowing that fpc developers is very skilled and they probably the know
things better than me I just wanted to suggest to implement something toward
the needed direction without even deciding on major details (sorry if it's
A little history. When the dynamic packages were introduced in Delphi, I did
a little inquiry about the magic behind it and the major change I noticed
was actually changing everything addressable in interface sections of units
from direct addressing to indirect addressing. So, if there's a variable in
the interface section of a unit, the corresponding dcu would not have a
direct entry to be linked, but actually an entry that contained the address
to the actuall variable. Interesting was the fact that it was true even for
everything statically linked (as I suppose, in order not to do the things
too complex). This would allow for the compiler to make a long table of
entries from one package that it needs from other packages, and the long
list of entries of the entries it offers to other packages. After that
depending on the build type, this tables were directly linked (single exe)
or splitted to import and export sections of dlls (bpl).
So, I just wanted to suggest that regardless of the magic different platform
has about such dynamic linking, there's something similar to this indirect
addressing possibly should be done with interfaces sections of the unit. So
even without actual dynamic packages implementation details, the fpc
compiler could start support intdirect addressing for ppu files. It may be
a conditional mode and in this case every ppu just can introduce a flag
indicating the mode it was compiled with or just be gradually implemented
unconditionally. The latter is not good for performance reasons and as I
recall after the discovery about indirect addressing we did some tests and
some artificial projects (for example a loop variable placed in the
interface section of a unit) showed very little performance degradation, but
for general approach it was almost unnoticeable.
What you think?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel