[lazarus] Classes and shared objects

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Nov 5 08:07:08 EST 2002


On Tue, 05 Nov 2002 15:45:56 +0300
"Vasily I. Volchenko" <Vasily.Volchenko at mstu.edu.ru> wrote:

> As I see, it was a great problem. So, lazarus executables are huge. It
> would be a good idea to place the code in shared object, one for all
> executables. But... Classes and shared objects are antagonists.
> But it is not impossible to place classes.o and others to shared
> object, and then... Then just
> fpc -Fn ____
> Fixing link.res.
> And linking!
> The result is tiny executable. I tried this. There were some good
> results (not with ld, but with gcc), but much more problems.

You can use dynamic libs with fpc (including object pascal). There is a
dynlibs.pp in the fpc1.1 cvs, which can also be used with 1.0.7.
Creating dynamic libs with object pascal support is very easy with the
ppumove program. 
But fpc does not yet fully support it and so there are some drawbacks:
- You can't use typed consts. Since the LCL is almost circle free 
  it is no problem to get rid of the typed consts in the LCL. But we
have 
  also to make sure, that no fpc lib is using them.
- You can't unload dyn libs when using ansistring constants. This is no
problem
  for normal programs. But it is a big problem for the package system. 
- Under windows you have to use a special heapmanager from borland.
- You have to convert _all_ used fpc libs (ppu files) into dynamic libs.

  Under linux this is pretty easy.

There might be some other drawbacks, but these were enough for me to
decide, that the Lazarus package system has to wait for fpc.
So, it might be possible to create a dynamic LCL lib under linux.  


Mattias






More information about the Lazarus mailing list