Board index » delphi » Cant Get a valid GetProcAddress from a valid DLL

Cant Get a valid GetProcAddress from a valid DLL

Hi,

I am trying to access some 32 bit DLL functions in the R&R Report
Writer 7.0 RRRPT32.DLL.  Here is the code:

{======= Begin Code ========}
Type
   TChooseReport = function(lpzAppName:PChar; lpzLibName:PChar;
lSize:Integer; lpzRepName:PChar; rSize:Integer):Integer;

{ other code/definitions.....}

procedure TRREntryForm.SpeedButton2Click(Sender: TObject);
var
   LibHandle:THandle;
   ChooseReport:TChooseReport;
   MyApp,MyLib,MyRpt:PChar;
   hRpt: Integer;

begin
   MyApp := StrAlloc(65);
   MyLib := StrAlloc(65);
   MyRpt := StrAlloc(65);
   try
     LibHandle := LoadLibrary('RRRPT32.DLL');
     @ChooseReport := GetProcAddress(LibHandle,'chooseReport');
     hRpt := ChooseReport(MyApp,MyLib,65,MyRpt,65);
   finally
     StrDispose(MyApp);
     StrDispose(MyLib);
     StrDispose(MyRpt);
   end;

end;

end.

{======== End Code  ===========}
procedure TRREntryForm.SpeedButton2Click(Sender: TObject);
var
   LibHandle:THandle;
   ChooseReport:TChooseReport;
   MyApp,MyLib,MyRpt:PChar;
   hRpt: Integer;

begin
   MyApp := StrAlloc(65);
   MyLib := StrAlloc(65);
   MyRpt := StrAlloc(65);
   try
     LibHandle := LoadLibrary('RRRPT32.DLL');
     @ChooseReport := GetProcAddress(LibHandle,'chooseReport');
     hRpt := ChooseReport(MyApp,MyLib,65,MyRpt,65);
   finally
     StrDispose(MyApp);
     StrDispose(MyLib);
     StrDispose(MyRpt);
   end;

end;

end.

What I am finding is happening is the LoadLibrary is returning a valid
handle to the DLL and is loading the DLL, but the GetProcAddress call
is not returning a reference to the function I want. I have tried a
lot of the other documented functions to no avail. I have verified the
case sensitive issues with Win32 DLLs and have located the function
table in the DLL and matched up the names using DOS debug.

Anyone have any ideas?

Regards,

Darren Forcier
Forcier Computer Services

 

Re:Cant Get a valid GetProcAddress from a valid DLL


Quote
Darren J Forcier wrote:

> I am trying to access some 32 bit DLL functions in the R&R Report
> Writer 7.0 RRRPT32.DLL.  

Skip the @.
Use stdcall (unless you _know_ the DLL is using the Delphi register
calling convention, which is very unlikely).

M.

--
Martin Larsson, author of several unknown utilities for DOS and Windows.
mailto:martin.lars...@delfi-data.msmail.telemax.no
http://www.delfidata.no/users/~martin
X.400:G=martin;S=larsson;O=delfi-data;P=msmail;A=telemax;C=no

Other Threads