[fpc-pascal] Cannot find entry point of a routine inside a windows 64 dll

Sven Barth pascaldragon at googlemail.com
Wed Dec 13 14:49:32 CET 2017


Am 13.12.2017 11:39 schrieb "Dennis Poon" <dennis at avidsoft.com.hk>:



Sven Barth via fpc-pascal wrote:

Am 13.12.2017 03:04 schrieb "Dennis" <dec12 at avidsoft.com.hk <mailto:
> dec12 at avidsoft.com.hk>>:
>
>     I am converting my windows 32 program to 64 bit.
>     It compiled with lazarus without any problem.(fpc 3.0.2)
>
>     I also compile the dll that is used, into a 64 bit dll.
>
>     However, when I ran the 64 bit program, windows reported 'cannot
>     find the entry point "the routine name in the dll" (the dll file name)
>
>     In the routine of the dll, there is an out parameter of type
>     WideString,
>
>     could this be the problem?
>
>     If not, what else could be the cause of the problem?
>
>
> Considering the code you gave I really wonder how that ever worked... Did
> you set the calling convention using the $calling directive? Otherwise you
> need to add it to every function. Also you're on the eager side by using
> the "name" clause for the external as you can be sure then what name is
> used. Lastly are you sure that the DLL you're dealing with is a 64-bit
> library?
>
> In the original 32 bit program, I wrote the windows 32-bit dll in the
Starter (FREE) edition of Delphi and call (using those codes I showed you)
from my FPC 32 bit program without any problem.
Since there is NO FREE Delphi for 64 bit version, I wrote a windows 64-bit
program using FPC 64 bit and then try calling it from my FPC 64-bit program
and encountered the "Cannot find entry point of a routine inside a windows
64 dll" error.


Just for clarification: is the excel_xp.dll written by you or by a 3rd
party? Or are you talking about a different library written by you? Because
in the latter case the interfacing choice between your program and *that*
library nicht be the culprit.

In the 32 bit program, I did not use the $calling directive and did not use
'name' clause and it worked perfectly.
I could add the name clause in the 64 bit program, but can you teach me how
to use the $calling directive?
Since in the 64 bit version, i will be writing both the dll and the calling
program, what $calling directive should I use?
Do I need to specify it clearly on both the dll and the calling code?


Perhaps before we go to this you should first explain a bit more how the
structure of your application looks like (regarding libraries), cause
currently I'm kinda confused.


Maybe you should take a look at fpSpreadsheet which allows you to work with
> Excel files of different versions directly and does not need a library.
>
> I tried to use the fpSpreadsheet sample program last time. If the 64 bit
dll thing did not work out, I will have to rely on the fpSpreadsheet thing
but my customers are all used to Excel and prefer sticking to it :-(


Are you trying to interact with a love running Excel instance? In that case
I agree. However if your trying to modify Excel files that are currently
closed then it shouldn't matter whether you use fpSpreadsheet.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20171213/48b88c7d/attachment.html>


More information about the fpc-pascal mailing list