[fpc-devel] BPL Package Questions
Michael Van Canneyt
michael at freepascal.org
Mon Sep 17 09:30:26 CEST 2007
On Sun, 16 Sep 2007, L wrote:
> http://wiki.freepascal.org/packages
>
> "PPUMove
> ppumove is a standalone binary in the FPC distribution that creates a shared
> libs from already compiled units. As far as I can see, this is already the
> beginning of a package system, except that it is manual (create packages
> manually yourself). This support and the makefile targets mostly dates back
> to the late 0.99.x/1.0.x series. (already before fpcmake)
>
> The RTL (on linux only?) makefile has a "shared" target, and Florian says it
> should be possible to create a shared lib of the rtl by running make clean
> all CREATESHARED=1 on Linux. Non x86_32 Linux needs the units to be compiled
> with PIC though, but the makefile seems to already add -Cg this for non
> x86_32. "
>
> I remember once Florian said he was able to compile lazarus with packages using
> PPUMOVE.
>
> How does shared memory work between DLL's though? i.e. ansistrings, RTTI,
> Dynamic arrays, reference counting?
There is a big difference whether you're using Windows or Linux.
But roughly the answer is like this:
Between DLLs it does not work, it works between packages. The reason for
this is that the DLLs can be considered separate programs, each with their
own memory manager. Packages form a single program, and therefore there is
only 1 memory manager.
>
> Is memory shared across DLL/EXE like I do with SetMemoryManager in this demo:
> http://www.freepascal.org/contrib/delete.php3?ID=543
This will always work for DLLs.
For Packages, there is no need to do this, since there is only 1 memory manager
instance.
>
> (but with fp package system it is just transparent/hidden somewhere?)
>
> How can PPUMOVE/RTL possibly know about sharing memory magically? Where does
> that magic occur? During initialization/finalization of the system unit with a
> SetMemoryManager() call so the DLL shares the EXE memory?
There currently is no magic, as there is no need.
> What does the CREATESHARED parameter do magically?
Nothing.
>
> And finally, when will I stop asking overwhelming questions and calm down?
This, only you can answer. (or your wife, when she hits you with a huge
baseball bat to calm you down). =-)
Michael.
More information about the fpc-devel
mailing list