🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
8 messages
8 total messages Started by Dmitry Wed, 06 Jun 2007 16:08
LoadLibrary and dependent packages
#1918
Author: Dmitry
Date: Wed, 06 Jun 2007 16:08
14 lines
1287 bytes
Hi All,


I have plugin system of bpl packages. Some packages use another packages.
Main application loads packages by LoadLibrary.
But if package A dependend of package B, LoadLibrary can not load package A,
unless package B loaded in memory.

How can i solve this problem?
Do i need to check for depencency each time when loading package by
LoadLibrary?

tx.
Dmitry.
Re: LoadLibrary and dependent packages
#1919
Author: Remy Lebeau (TeamB)
Date: Wed, 06 Jun 2007 17:05
11 lines
1146 bytes
"Dmitry" <dmitry@pikalevo.com> wrote in message
news:4666dbbb$1@newsgroups.borland.com...

> I have plugin system of bpl packages. Some packages use another
> packages. Main application loads packages by LoadLibrary.

BPL packages must be loaded using LoadPackage(), not LoadLibrary().


Gambit
Re: LoadLibrary and dependent packages
#1920
Author: Dmitry
Date: Thu, 07 Jun 2007 06:05
20 lines
1716 bytes
Remy,
> BPL packages must be loaded using LoadPackage(), not LoadLibrary().

this solution seems  not trivial for my situation since i use bpl packages
as dll libraries.
there are many other problems arise when i change my code to LoadPackage.
For example i staring to get exeptions about double units since i change
LoadLibrary to LoadPackage.

Packages being loaded by LoadLibrary, normaly can use each other classes
defined with PACKAGE macro.

perhaps i just have to obviously load all bpl that my application uses by
LoadLibrary at application start,
since LoadPackage does dependency check and loads packages also.
In my design bpl plugins located in different than application directory.


tx.
Dmitry
Re: LoadLibrary and dependent packages
#1939
Author: Remy Lebeau (TeamB)
Date: Fri, 08 Jun 2007 20:14
38 lines
2319 bytes
"Dmitry" <dmitry@pikalevo.com> wrote in message
news:46679fe4@newsgroups.borland.com...

> this solution seems  not trivial for my situation since i use
> bpl packages as dll libraries.

BPLs are more than just DLLs.  LoadPackage() calls LoadLibrary()
internally, but it also calls the package's initialization procedures
as well.  LoadLibrary() alone does not do that.  You MUST use
LoadPackage() instead of LoadLibrary() directly for BPL files.

> there are many other problems arise when i change my code
> to LoadPackage.

Then your code is likely using the packages incorrectly to begin with.

> For example i staring to get exeptions about double units since
> i change LoadLibrary to LoadPackage.

The same unit cannot be loaded by multiple packages in the same
process space at one time.  That is a core requirement of the BPL
architecture.  Shared code has to be in its own package that the other
package then list in their Requires list.

> Packages being loaded by LoadLibrary, normaly can use each other
> classes defined with PACKAGE macro.

LoadLibrary() does not execute a package's initialization code.

> perhaps i just have to obviously load all bpl that my application
> uses by LoadLibrary at application start, since LoadPackage
> does dependency check and loads packages also.

Or you could simply design your packages correctly in the first place.


Gambit
Re: LoadLibrary and dependent packages
#1807
Author: Dmitry Konnov
Date: Sun, 10 Jun 2007 06:50
8 lines
1301 bytes
Remy,
> LoadLibrary() does not execute a package's initialization code.

Can you explain what exacly is an initialization of package?
I have remade in my code to use LoadPackage.

Dmitry.
Re: LoadLibrary and dependent packages
#1819
Author: Remy Lebeau (TeamB)
Date: Mon, 11 Jun 2007 16:42
11 lines
1272 bytes
"Dmitry Konnov" <dmitry@weblinedesign.biz> wrote in message
news:466b9f39$1@newsgroups.borland.com...

> Can you explain what exacly is an initialization of package?

Doing unit duplication checking, and then calling of the individual
unit startup procedures.


Gambit
Re: LoadLibrary and dependent packages
#1823
Author: Dmitry
Date: Tue, 12 Jun 2007 07:37
17 lines
1348 bytes
Remy,

> > Can you explain what exacly is an initialization of package?

> Doing unit duplication checking,

OK.

> and then calling of the individual
> unit startup procedures.

Do you mean?
#pragma startup
#pragma exit

Dmitry.
Re: LoadLibrary and dependent packages
#1833
Author: Remy Lebeau (TeamB)
Date: Tue, 12 Jun 2007 15:51
14 lines
1478 bytes
"Dmitry" <dmitry@pikalevo.com> wrote in message
news:466e4cee@newsgroups.borland.com...

> Do you mean?
> #pragma startup
> #pragma exit

I mean the "Initialization" and "Finalization" sections of Delphi
units.  I do not know if Borland implements those #pragma statements
in the same way for C++.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads