[fpc-devel] FPC dynamic libraries

Michael Van Canneyt michael at freepascal.org
Thu Feb 8 13:52:48 CET 2007

On Thu, 8 Feb 2007, Daniƫl Mantione wrote:

> Op Thu, 8 Feb 2007, schreef Mattias Gaertner:
> > Plugins. For example installing a design time package.
> > Contrary to normal apps an IDE has the advantage to recompile
> > if needed. So Lazarus has only a subset of the normal dyn lib problems.
> > But I know, that as soon as the IDE can load packages as dynamic libs,
> > programmers will use dyn libs for their apps too and probably use
> > them as shared libs. And then FPC+Lazarus bug tracker will get new
> > trouble. So although I only want plugins, I ask about libs in
> > general.
> Design a plugin binary API, dynload the plugin. It is not necessary that 
> the RTL is shared for this purpose (allthough it could reduce the size).
> This way you only have to keep the plugin API backwards compatible, 
> and could allow binary plugins to be used with any Lazarus version. 
> Keeping a plugin API compatible is very doable, unlike of the full RTL, FCL 
> and LCL, which seems next to impossible to me.

Why ? Borland does it.

Secondly, there are serious problems with this approach which make it unusable
for an IDE like Lazarus.

Assume I get a component instance from the plugin (MyObject), then extremely 
simple and basic statements like

If (MyObject is TComponent) then

will fail, even though MyObject is a TComponent, because the VMT of the 
MyObject TComponent parent resides in the library, and the VMT of TComponent
used in the If statement is inside Lazarus, causing the statement to fail, 
even though it should be true. When using packages, the statement will function

The only option are packages, and packages need an RTL in a dynlib.

That this requires a strict versioning schedule, is part of the deal. 
Borland's packages are also incompatible between released versions.


More information about the fpc-devel mailing list