Forum > Windows (32/64)



My system is Win10 and Lazarus 2.0.10 with freepascal 3.2.0.

I have successfuly converted a Delphi 7 project. This project makes use of two Windows dll's. The following code worked successfully when compiled with Delphi, but not with Lazarus. Lazarus build is successful so syntax seems OK, it is execution that is problematic.

the variable Wes5Handle is returned as a zero so the message 'Unable to load Wes5ENG.dll' is displayed.

Code is below, any input would be appreciated.

  Wes5Handle := LoadLibrary('Wes5ENG.dll');
  if Wes5Handle <> 0 then
    @ftn_Wes5ENG := GetProcAddress(Wes5Handle,'_ftn_wes5eng@116')
    MessageDlg('Unable to load Wes5ENG.dll',mtError,[mbAbort],0);
  if (@ftn_Wes5ENG = nil) then
    MessageDlg('Could not import function from Wes5ENG.dll',mtError,[mbAbort],0);




You did not mention if the DLL is 32-bit or 64-bit, nor did you say if your application matches it. I guess they do not match.

My apologies for not giving all that detail. The dll was developed pre-2008 in FORTRAN, most probably 32-bit. I used stdcall, had to convert all arrays to C.

Lazarus now (I assume) is 64 bit, I haven't checked, just installed.

Problem is I only have Intel 32-bit compiler, will now try and see if I can compile with gfortran, I have no experience with grfortran.

Thanks again

Both sides (application and dll must be the same, either 32-bit or 64-bit).

So upgrade DLL or change lazarus edition


[0] Message Index

Go to full version