🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1939

Re: LoadLibrary and dependent packages

#1939
From: 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
Technical Details
Message-ID: <4669b918$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4666dbbb$1@newsgroups.borland.com> <4666e9e1$1@newsgroups.borland.com> <46679fe4@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c0473ff6199f2d90
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4666dbbb$1@newsgroups.borland.com> <4666e9e1$1@newsgroups.borland.com> <46679fe4@newsgroups.borland.com>
Subject: Re: LoadLibrary and dependent packages
Date: Fri, 8 Jun 2007 13:14:39 -0700
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.82.252.126
Message-ID: <4669b918$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1181333784 75.82.252.126 (8 Jun 2007 13:16:24 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail