Assaf, Seems an interesting project. >From what I can see ExecF is already a procedure and perhaps you mean
ExecF := GetProcAddress(phm, 'GetDrive'); no @ mick > Message: 1 > Date: Mon, 20 Jun 2005 11:34:11 +0200 > From: "Assaf Stone" > <[EMAIL PROTECTED]> > Subject: Problems loading a BPL package dynamically > in D7 > > Hello all. > > I'm using Delphi 7, and I've got a driver in a BPL > file that I wish to > load dynamically. I've added the problem code below. > > What I do is, locate the file, then run LoadPackage, > and then > GetProcAddress, to run the procedure (GetDriver) > that returns the driver > object (the procedure creates the proper subclass of > the parent driver > class). > > However, when I run the code, the driver procedure > (ExecF) is > unassigned, and that of course, is not what should > be. > > The GetDriver is declared globally and implemented > in the driver BPL, > and is defined exactly as the ExecF variable below > is. > > Any ideas what I'm doing wrong here? > > P.S. The code I use to run it is based on a demo > source I found in > delphi.about.com. I'm pretty much certain that it > should work as > advertised. :-) > > Thanks, > Assaf. > > procedure TfrmPSM.FormCreate(Sender: TObject); > var aPointSensorDrv: TPointSensorDrv; > aPackageList: TStringList; > phm: HModule; > ExecF: procedure (var aPointSensorDrv: > TPointSensorDrv); > begin > aPackageList := TStringList.Create; > > aPackageList.Add(ExtractFilePath(Application.ExeName) > + > 'PsWirOneWay.bpl'); > > phm := LoadPackage(aPackageList.Strings[0]); > if phm <> 0 then // <---------- This works fine > try > @ExecF := GetProcAddress(phm, 'GetDrive'); > if Assigned(ExecF) then > //--------------^^^^^ > // This returns nil, and Assigned returns false. > begin > ExecF(aPointSensorDrv); > end; > finally > UnloadPackage(phm); > end; > end; > > Assaf Stone > Spacelogic ltd. > [EMAIL PROTECTED] > Tel: 972-9-8855565 ext. #315 > Send instant messages to your online friends http://au.messenger.yahoo.com ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

