1. Sufyan Maghur
  2. PowerBuilder
  3. Tuesday, 12 December 2023 15:22 PM UTC

Good day...

Trying to connect to IBM MQServer using the IBM DLL mqic32.dll

 MQCONN - Connect queue manager - IBM Documentation

The Function Definition in the PB Code

Subroutine MQCONN ( String QMgrName, REF Long Hconn, REF Long CompCode, REF Long Reason ) Library "MQIC32.DLL"

But when we execute the Call we get an error about argument types (I reviewed the Types and they seem to be fine)... Any idea?

Error attached

Attachments (1)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 12 December 2023 18:01 PM UTC
  2. PowerBuilder
  3. # 1

Hi Sufyan;

  Just a guess here but ... I am wondering if IBM's API is based on an old version of "C/C++" that uses 1 byte memory alignment vs today's newer C++ compilers (like PB uses) current default of 4 bytes. If that might be the case, try running your PB App under the IDE using this setting ...

HTH

Regards ... Chris

Comment
  1. Sufyan Maghur
  2. Tuesday, 12 December 2023 19:47 PM UTC
Hi Chris...

I set up as you suggested but still the same error (I am also trying to get an explanation from IBM) not sure If I will have any success :)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 12 December 2023 20:39 PM UTC
Yes, it looks like the next issue could be their API(s) requiring a different data type then what you are passing. :-(
  1. Helpful
There are no comments made yet.
Sufyan Maghur Accepted Answer Pending Moderation
  1. Tuesday, 12 December 2023 16:05 PM UTC
  2. PowerBuilder
  3. # 2

Yes it is 32... I even tried their 64 mqic.dll but still the same error

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 12 December 2023 16:00 PM UTC
  2. PowerBuilder
  3. # 3

What version/release/build of PB?

Is the DLL 32-bit or 64-bit? Is the PB app 32-bit or 64-bit? The bitness of the app and the DLL must be the same.

Does the DLL expect the string argument to be ANSI-encoded or Unicode? If Unicode, PB can only supply Unicode 16LE (16-bit, Little Endian) encoding. If ANSI, you need to include "ALIAS FOR "MQCONN;ansi" at the end of the external function declaration in order for PB to perform the encoding translation.

Does the DLL use the _stdcall (aka WinAPI) calling interface? PB can only interface with external DLL's that utilize the _stdcall calling interface.

Comment
  1. Sufyan Maghur
  2. Tuesday, 12 December 2023 16:08 PM UTC
Yes using 32 same as the DLL (I also tried with 64 both BUT still got the same error)

I already tried the ALIAS also just to make sure about the ANSI but still same...
  1. Helpful
  1. John Fauss
  2. Tuesday, 12 December 2023 21:02 PM UTC
Do you have access to any (online) documentation regarding this particular DLL function that you can share?
  1. Helpful
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.