1. D Aggelis
  2. PowerBuilder
  3. Tuesday, 31 January 2023 19:15 PM UTC

Hi, I need to call an external function from a dll that user pointers to BSTR datatype as arguments to return results. I haven't found an equivalent datatype so far (PB 11.2, 12.6).  Is there any workaround in Appeon PB?

John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 1 February 2023 03:03 AM UTC
  2. PowerBuilder
  3. # 1

I have found this documentation about the BSTR data type:

   https://learn.microsoft.com/en-us/previous-versions/windows/desktop/automat/bstr

Essentially, the BSTR data type is a pointer to a Unicode character string, same as a PB String data type argument. One thing that might concern me is that this documentation mentions that the BSTR data string may contain imbedded null characters. If the BSTR's your DLL produces do this, you will not be able to obtain all of the information without a memory copy into a PB Blob because the first null that is encountered will mark the end of the string.

If the data string contains a "normal" character string that does NOT contain imbedded null characters, I think you should be able to use the standard PB String data type in the external function declaration.

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 31 January 2023 20:18 PM UTC
  2. PowerBuilder
  3. # 2

If this is a Windows API function, what is it?

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 31 January 2023 21:05 PM UTC
  2. PowerBuilder
  3. # 3

I looked it up and BSTR is a Visual Basic String. If this is a VB DLL, it should be deployed as a COM and accessed from PB using OLEObject.

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 31 January 2023 22:28 PM UTC
Wow .. is that ever an old "puppy"! :-(\
  1. Helpful
There are no comments made yet.
D Aggelis Accepted Answer Pending Moderation
  1. Tuesday, 31 January 2023 21:27 PM UTC
  2. PowerBuilder
  3. # 4

well it is a dll used to communicate with a fiscal memory device.

From the documentation:

*******************************************************************************
9. DLL specification
*******************************************************************************

  * The functions have a PASCAL calling convertion (same as win APIs).
  * The functions provided by this DLL are *NOT* reentrant.
  * Many of these functions are blocking.
  ...

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.