Home Calling external dll after delphi upgrade

# Calling external dll after delphi upgrade

Jack Gray
1#
Jack Gray Published in 2015-10-13 08:09:22Z
 I have upgraded my Delphi 2007 application to Delphi Seattle. In Delphi 2007 I had a Fortran DLL which was called from my Delphi application. After upgrade I get an error 'Procedure end point not found'. Please note that there is no change to the Fortran DLL and the dll is in the same path as the application exe The call code from Delphi is type TArrayOfTypeNos= array [1..1000] of Integer; .... procedure CallFunc( Idx : Integer; var Nos : Integer; var ProductTypes : TArrayOfTypeNos ); stdcall; external 'MyFortranDLL.dll' name '_ThisIsFuncNameinFortran';  Can someone please give me some idea as to what could be wrong? The error I get is: The procedure entry point _ThisIsFuncNameinFortran could not be located in dynamic link library
David Heffernan
2#
David Heffernan Reply to 2015-10-13 09:06:50Z
 Nothing has changed between Delphi 2007 and Delphi 10 Seattle that affects the function shown in the question in any way. The common problems that arise when moving between pre-Unicode Delphi, and Unicode Delphi, relate to differences in the treatment that character and string types. So, Char was formerly an alias to AnsiChar, but is now an alias to WideChar. Likewise for PChar, string etc. But that's not the case here. The types that you use have identical meaning on all Delphi versions from Delphi 2 upwards. The error message is: The procedure entry point _ThisIsFuncNameinFortran could not be located in dynamic link library. There is only one way to interpret that error message. The DLL has been located, but it really does not export a function with that name. Check that the actual DLL loaded really is the one that you intended to load. Dependency Walker, or a similar tool, can probably help.
Remy Lebeau
3#
Remy Lebeau Reply to 2015-10-13 17:58:49Z
 If the DLL really has not changed, this code should have been failing in D2007 to begin with. The fact that it works in 2007 but fails in Seattle likely means the same DLL is not being loaded. You can use a tool like Process Explorer or Process Monitor to see which DLL is actually being loaded. And use Embarcadero's TDUMP utility to see which functions the DLL actually exports.
 You need to login account before you can post.
Processed in 0.322695 second(s) , Gzip On .