1. Pierre DETE
  2. PowerBuilder
  3. Thursday, 11 July 2024 13:36 PM UTC
 
Hello,
 
We need your help.
 
We have a problem passing data between pb2022 and an external function in a dll. All this in 64bits. This function works in PB2019 also in 64bits.
 
But with PB2022 this is what happens:
 
The extran function returns : return((void *)pHdlLicence); Something like that for example : 000001F5BBE798F0
But with PB we get FFFFFFFFBBE798F0 in a ULong or LongPtr or Longlong
 
The functionwas like this :
FUNCTION ulong KtpElsRequestNew () LIBRARY "ktpels6.dll" ALIAS FOR   "KtpElsRequestNew"
It was working with PB2019.
Now with PB2022 as it's not working we have try : 
FUNCTION LongPtr KtpElsRequestNew () LIBRARY "ktpels6.dll" ALIAS FOR   "KtpElsRequestNew"
or 
FUNCTION LongLong KtpElsRequestNew () LIBRARY "ktpels6.dll" ALIAS FOR   "KtpElsRequestNew"
 
But nothing works. Where is the error?
 
Thank you in advance.
 
 
 
 
 
 

 

 

 

 

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 11 July 2024 15:01 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Pierre -

My quick answer is "I don't know", but I suspect this issue might be a result of PB 2022 having been built using a newer version of Visual Studio or because the DLL is a 32-bit DLL.

Because I have no familiarity with this DLL, I have many questions:

Is the ktpels6.dll locally/internally developed or is it a vendor-supplied DLL?
Is it a 64-bit DLL or is it a 32-bit DLL? (If you are trying to call it from a 64-bit PB app, the DLL also must be compiled for 64-bit).
How old is it? In other words, what software/version has been used to create this DLL?
What is the source language for this DLL?
Can you verify that this DLL entry point uses the __stdcall (Windows API) argument passing protocol? 
Although you have provided the source code return statement for this external function/entry point, can you please provide the function's source prototype statement?

FYI - You do not have to include the "ALIAS FOR" clause in an external function declaration in PB when the name you assign to the external function matches exactly with the name of the function within the DLL.

Best regards, John

Comment
There are no comments made yet.
Pierre DETE Accepted Answer Pending Moderation
  1. Thursday, 11 July 2024 15:29 PM UTC
  2. PowerBuilder
  3. # 1

Hi, John

 

Thank you for your help, there was some int still in the prototypes. In not a C++ expert...

 

Best regards, Pierre

 

Comment
  1. John Fauss
  2. Thursday, 11 July 2024 15:50 PM UTC
I'm not a C++ expert either ;-), and I'm very glad to hear the great news, Pierre! You're welcome. Good luck on your project!
  1. Helpful 2
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.