Is there a way to get hold of a function in a package the same way as with .dll's (GetProcAddress). The thing is that I'd like to have a base class say TMyBase. In the application I'd like to load components dynamically so I dont know the name of the main class in the components. The component's main class inherits from TMyBase and implements a function <function GetMainClass : TMyBase>. When the application starts loading components I'd like it to work like this
TGetMainClass = function(....) : TMyBaseClass;
aGetMainClass : TGetMainClass;
for i:=0 to myPackageList.count-1 do
myPackageList[i].itsHandle := LoadPackage(myPackageList[i].itsName);
@aGetMainClass := GetProcAddress(myPackageList[i].itsHandle, 'GetMainClass');
myPackageList[i].itsMainClass := aGetMainClass(..)
This way I can read the settings in the registry file to obtain the components installed and easely install a new component without recompiling the application.
The problem I have is that @aGetMAinClass returns nil?