Article View: borland.public.cppbuilder.nativeapi
Article #3115Re: Dynamic package loading
From: Pere Mateu
Date: Wed, 11 Oct 2006 10:24
Date: Wed, 11 Oct 2006 10:24
55 lines
2323 bytes
2323 bytes
Hi Remy,
Thanks for your kind answer, but I still can't get it to work.
This is what I'm exactly doing in the package (named MyPackage.bpl):
namespace Mypackage
{
void __fastcall PACKAGE Register()
{
RegisterClass(__classid(TForm1));
}
}
In the main app (Build with runtime packages checked), I do this:
try {
int bpl=LoadPackage("Mypackage.bpl");
if (!bpl) { ShowMessage("error"); return; }
TMetaClass* p=GetClass("TForm1");
if (!p) { ShowMessage("No class"); return; }
UnloadPackage(bpl);
} catch (...) {
ShowMessage("error");
}
I always get a "No class" error, because the GetClass() can't find the
TForm1 class.
Am I doing anything wrong?
Thanks very much again,
Pere
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> escribi๏ฟฝ en el mensaje
news:45243d18@newsgroups.borland.com...
>
> "Pere Mateu" <pmateu@siam.es> wrote in message
> news:45242db4@newsgroups.borland.com...
>
>> I register the class in the package (in the DllEntryPoint)
>
> Incidently, you should not be calling RegisterClass() from DllEntryPoint()
> directly. Each of your that wants to register classes should be exporting
> its own Register() function instead. The VCL automatically calls the
> Register() functions when loading the package. Call RegisterClass() from
> inside of Register().
>
>
> Gambit
>
>
Technical Details
Message-ID:
<452cc66b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<45242db4@newsgroups.borland.com> <45243d18@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,cc7dce882f3cfdcc X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII From: "Pere Mateu" <pmateu@siam.es> Newsgroups: borland.public.cppbuilder.nativeapi References: <45242db4@newsgroups.borland.com> <45243d18@newsgroups.borland.com> Subject: Re: Dynamic package loading Date: Wed, 11 Oct 2006 12:24:41 +0200 Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 81.203.224.65 Message-ID: <452cc66b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1160562283 81.203.224.65 (11 Oct 2006 03:24:43 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail