1. Dhanya K
  2. PowerBuilder
  3. Thursday, 10 August 2023 07:10 AM UTC

Hello Team

I am using Powerbuilder 2022(Version 1878). We are using some functions from ODBC32.dll, which is not working while running in 64 bit. Could you please help.

Accepted Answer
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 08:21 AM UTC
  2. PowerBuilder
  3. # Permalink

As mentioned in help:

  • Longptr

    In the 32-bit platform, longptr is the same as long; you can continue using long wherever longptr is required in 32-bit applications. In 64-bit applications, however, using long to hold longptr variables will lead to data truncation from 8 bytes to 4 bytes, or memory corruption if you pass a long ref variable when a longptr ref is required. If you want to migrate to 64-bit, use longptr wherever required as it does no harm to 32-bit.

    Since PowerBuilder does not have a datatype corresponding to the C++ pointer type, and there are no pointer operations in PowerBuilder, longptr is not a full-fledged PowerBuilder datatype. You can use it to hold/pass window handles, database handles, and other objects that are essentially memory addresses. Doing complex operations on longptr type might not work. If you want to represent/compute 8-byte long integers, use longlong.

  • LongLong

    To take advantage of the 64-bit architecture, you can change your Long datatype variables to LongLong. Because this datatype is for 64-bit signed integers, from -9223372036854775808 to 9223372036854775807.

    Keep in mind that LongLong continues using literals as for integers, but longer numbers are permitted.

You can find this on the following link: Step 2 - Datatypes - - Migrating 32-bit Applications to 64-bit (appeon.com).

Some methods from odbc32.dll are used to pass handles, so I guess you have to use longptr or longlong. You should modify your declarations and test again.

Andreas.

Comment
There are no comments made yet.
Dhanya K Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 08:38 AM UTC
  2. PowerBuilder
  3. # 1

Thank you so much for the quick help.

Comment
There are no comments made yet.
Arnd Schmidt Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 08:14 AM UTC
  2. PowerBuilder
  3. # 2

Take a look at the maintained PowerBuilder ODBC.dll API Example here:

https://www.topwizprogramming.com/freecode_odbcapi.html

hth

Arnd

Comment
There are no comments made yet.
Dhanya K Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 07:35 AM UTC
  2. PowerBuilder
  3. # 3

This is how we have declared, 

FUNCTION integer SQLAllocHandle(int handletype, long inputhandle, ref long ouputhandle) library "odbc32.dll"
FUNCTION integer SQLFreeHandle(int handletype, long inputhandle) library "odbc32.dll"

FUNCTION integer SQLExecDirect(long statementhandle, string sqlstatement, long sqlstatementlen) library "odbc32.dll" alias for "SQLExecDirectW"

Comment
There are no comments made yet.
Dhanya K Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 07:32 AM UTC
  2. PowerBuilder
  3. # 4

Hello,

These are the functions we use,

SQLAllocHandle,SQLFreeHandle,SQLExecDirectW. The datatype of some arguments in these functions - like long inputhandle of SQLAllocHandle function are creating issues.

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 10 August 2023 07:25 AM UTC
  2. PowerBuilder
  3. # 5

Hi.

Your question is to generic. Can you please let us know which functions you are trying to use and do not work? Can you provide how those external functions are declared in your application?

Andreas.

Comment
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.