[fpc-devel] Delphi-like Packages, Plan

Sven Barth pascaldragon at googlemail.com
Sun Oct 3 20:06:45 CEST 2010


On 03.10.2010 18:43, Willibald Krenn wrote:
> Hi!
>
> Here comes my 'official' plan on how I want to implement Delphi-like
> Package Support for FPC on Win64. Feel free to comment.
>
>
>
> Definitions
> ~~~~~~~~~~~
> <File>.ppl Free-Pascal Package Library
> (shared module, Delphi: bpl)
> <File>.ppk Free-Pascal Package
> (source, Delphi: dpk)
> <File>.pcp Free-Pascal Compiled Packge
> (header, ppu's, Delphi: dcp)
> (skip package collections for now)
>
> -K <File>[ <File>]*
> Command line arg to tell fpc to compile
> program/dll with runtime package support.

With this argument you want to specify which packages to use? Then you 
should use a syntax that is more compatible to the other FPC options:

-K<File> [other options] -K<File> [...]

Also you might want to add it as a new -F* option (e.g. -Fp or -FP) 
instead of -K, because the -F* options are for filenames and paths.

>
> -> M1
> ~~~~~
> Goal: - Compile System unit into a "fpcrtl.ppl"
> - Create a simple application that uses fpcrtl.ppl.
> -> Perhaps some simple string sorting program.
>
> Idea: Create a TPackageModule class, might be some descendant of
> TPpuModule or TModule, that holds the information found in the
> ppk. Don't include the ppu files in the ppk (yet).

If you want this TPackageModule or whatever in system.pp (e.g in the 
RTL, not in the compiler) you should use records, because objpas.pp is 
not loaded inside system.pp (and thus TObject isn't available).

>
> Change pmodules.proc_package to load all units found in the
> packages of the requires section, create idata for the ppl,
> create pcp file.
>
> Add command line parameter (-K) so that applications can be
> compiled with packages. Change pmodules.proc_program to pre-load
> all units of all referenced packages.
>
> -> M2
> ~~~~~
> Goal: - RTTI in ppk
> - Basic OOP support in ppk (ClassInfo etc.)
> - Include all ppu information in pcp file
>
> To Consider:
> Add Name mangling for RTTI (etc.) if not yet existant.

What do you want to mangle here?

>
> Find code in the rtl that needs to be changed (if any).
>
> Threads/Thread Local Storage?

Yes, that will be another difficult topic...

>
> Tests.
>
> -> M3
> ~~~~~
> Goal: - Implement missing functionality
> (Weakpackage, CompilerSwitches...)
> - Provide ppk files for class library
> - add tests
> - merge into trunk

As it doesn't seem that you're working in a branch on the FPC repository 
you might want to send small patches (e.g. your milestones) to the FPC 
team as they can be discussed and merged more easily than one big patch 
(and you don't want to repeat your complete work only because a 
important feature at the beginning wasn't implemented correctly ^^)

Regards,
Sven



More information about the fpc-devel mailing list