Subject | Re: [IBO] BPL vs. DLL |
---|---|
Author | Lele Gaifax |
Post date | 2001-08-04T14:34:04Z |
>>>>> On Sat, 04 Aug 2001 13:20:01 -0000, manuelfresnedaguerra@... said:m> I have a very large program, with a very big exe, i want to
m> divide it in small pieces, and my question is , what is the
m> best, using DLL's or using packages (BPL), it have a lot of
m> forms.
Technically a BPL *is* a DLL. The difference is mainly due to how they
get loaded by the Delphi runtime: the LoadPackage(), after loading the
library with the usual LoadLibrary(), digs in its exported/imported
symbol tables to "unify" them with the symbols of the host
application, thus giving a consistent "namespace". To make it clear
with an example, consider the "Application" symbol: it is desiderable
that it points to the same instance of the class TApplication in both
the library code and in the host application. This applies to all
symbols, even the classes themselves: simply loading a DLL would give
you multiple copies of the their implementation data-space.
Using BPLs makes a lot easier to reach your goal, given that by any
chance you want for example a common shared connection with the DB:
they let you build a little, generic, DB-un-aware application that
simply loads a set of packages, one of them actually containing a
single TIB_Connection instance that will be passed in some way as a
parameter to the others.
Having used similar technology under real operating systems makes me
wonder why the Delphi machinery is not the standard way of dealing
with dynamic loadable chunks of code...
bye, lele.
--
nickname: Lele Gaifax | Hold on, hold on - They put you in a box so you
real: Emanuele Gaifas | can't get heard - Let your spirit stay unbroken,
email: lele@... | may you not be deterred - P.Gabriel "Wallflower"