Using unicode API with PowerBuilder?

Hello everyone,

we are currently in the process of converting our PowerBuilder application to use unicode instead of ANSI. We already made good progress, but are currently looking into our external function calls.

Currently we are using “List & Label 24” and the two respective PowerBuilder objects “u_cmll24” and “u_cmls24”, which came shipped together with the “List & Label 24” installation.
Doing some research it was found that next to all defined external function calls within the above mentioned objects are defined as ANSI, e.g. :

FUNCTION LONG LlDefineField(LONG hLlJob, ref STRING pszVarName, ref STRING lpbufContents) LIBRARY “CMLL24.DLL” ALIAS FOR “LlDefineFieldA;ANSI”

So far we already found out, that by replacing “A;ANSI” with “W” at the end of each external function we are able to switch from ANSI (“A API”?) to unicode (“Unicode API”) :

FUNCTION LONG LlDefineField(LONG hLlJob, ref STRING pszVarName, ref STRING lpbufContents) LIBRARY “CMLL24.DLL” ALIAS FOR “LlDefineFieldW”

First tests showed that by doing this, the most part of the used functionality by us is working fine. Unfortunately we are running into problems when trying to open the designer or preview window for labels.

So I would like to ask :

  1. Does anyone have experience on calling the “unicode API” from PowerBuilder?
  2. Are we missing something? Maybe some kind of initialization?
  3. How come the “list” printouts are all working fine, but when trying to open the labels the designer will crash without any real error message within the debwin4 window? And when trying to open the preview window, the first attempt is working fine but the second attempt will open up empty with an “bad allocation” error on the debwin4 window?

Best regards,
Constantin Bergatt

Hi and thanks for reaching out.

What you’ve done so far sounds perfectly fine. If you’re actually seeing a crash when opening the label designer, I’d suggest to contact support directly via the support portal. We’d have to exchange a dump file alongside your project file and the debug log to see what actually happens on your end. Once we’ve nailed down the culprit, we could post the result here. Does that make sense to you as well? If so, just open a case, refer to this thread and we’ll send you instructions what you need to do.

Hi @jbartlau,

many thanks for your quick reply!

As suggested I have created a new support case W201911040001.

Best regards,
Constantin Bergatt

1 Like