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

Dennis Poon dennis at avidsoft.com.hk
Wed Dec 13 11:38:57 CET 2017

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.

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?

> 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 :-(

Thanks for your response.

> Regards,
> Sven
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list