1)i'm testing the use of dynamic packages
2)in a package I create a unit with:
type
TTest=class(TPersistent)
public
s:string;
end;
implementation
initialization
RegisterClass(TTest);
finalization
UnRegisterClass(TTest);
end.
3)In the package projetc options I chose runtime and design time
4)i create a application with a button with:
var
m:HMODULE;
aclass:TPersistentClass;
begin
m:=LoadPackage('test.bpl');
if m<>0 then
begin
aclass:=GetClass('TTest');
if aclass=nil then
showmessage('error');
UnloadPackage(m);
end;
end;
5)all fine with m<>0
6)the problem is:
GetClass always returns nil
why it can´t find TTest
I am not registering TTest correctly?
Thanks in advance!
Ricardo
2)in a package I create a unit with:
type
TTest=class(TPersistent)
public
s:string;
end;
implementation
initialization
RegisterClass(TTest);
finalization
UnRegisterClass(TTest);
end.
3)In the package projetc options I chose runtime and design time
4)i create a application with a button with:
var
m:HMODULE;
aclass:TPersistentClass;
begin
m:=LoadPackage('test.bpl');
if m<>0 then
begin
aclass:=GetClass('TTest');
if aclass=nil then
showmessage('error');
UnloadPackage(m);
end;
end;
5)all fine with m<>0
6)the problem is:
GetClass always returns nil
why it can´t find TTest
I am not registering TTest correctly?
Thanks in advance!
Ricardo