1. Tomas Beran
  2. PowerBuilder
  3. Wednesday, 15 February 2023 14:28 PM UTC


Is there a way how to get list of stack calls into a variable, message or another object?

Like Java can do it in exception.

What's going on:

In my SW I'm catching systemerror, datawindow errors etc and I'm sending these errors through mails. In the mail I see the affected object, line of code and the error itself. But sometimes this is not enough and the stack listing would be fine here. But how to get it? Stack calls are visible in the IDE so there must be a chance to get them.

Thank you

Accepted Answer
Marc Wietscher Accepted Answer Pending Moderation
  1. Friday, 17 February 2023 08:44 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Tomas,

as Chris already stated, unfortunately PB doesn't offer access to the stacktrace during runtime and this has been an enhance request for serveral years. But meanwhile you may want to consider trying a third party tool called "fastfuncs". Among some high performance string manipulation methods it provides you a method that retrieves the current stacktrace as an array. You might need to use Visual Studio (or maybe SnapDevelop?) to replace the PBxxx.dll references and recompile the dll to match your version of PowerBuilder. As I remember right, you just need to modify the additional dependencies of the release to the PB version you are using. (see screenshot)

We have been using it in out applications developed in PB2017R2 and PB2019R3 for some time now and it works like a charm.

Check out the git page: https://github.com/lakeman/fastfuncs

In PB you would declare it as an external function, eg.:

SUBROUTINE GetCallstack(REF STRING as_call_stack[]) SYSTEM LIBRARY "fastfuncs190.dll" ALIAS FOR "Stack_Trace"

Finally in your code you can call something like


string lsa_callstack[]


to receive the current stack trace.

See the attached screenshot as an example. Hope it fits your needs.


Best regards,


Attachments (2)
  1. Arnd Schmidt
  2. Friday, 17 February 2023 13:23 PM UTC
That was helpful Jeremy!!! :-)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 17 February 2023 13:31 PM UTC
Hi Marc... That is awesome information - thanks!
  1. Helpful
  1. Marc Wietscher
  2. Friday, 17 February 2023 13:55 PM UTC
I'd like to add, as Arnd already pointed out, that I am not the author of this project and that the project has not been modified for the past 11 years. But it still works without problems for PB2017 and PB2019. Though I haven't tested it with PB2022 yet, I believe it should work there, too.

Still it would be great to have this as a built-in functionality coming with future PB releases, so we do not need to rely on third-party software when it comes to PB core routines.
  1. Helpful 3
There are no comments made yet.
Tomas Beran Accepted Answer Pending Moderation
  1. Monday, 20 February 2023 17:55 PM UTC
  2. PowerBuilder
  3. # 1

Hi Marc

Thank you for your helpful reply. The code looks great. The only question is of Orca is still supported in PB2022.

I'd like to rewrite the Jeremy's code to C# but I'm not sure with the callbacks between managed and unmanaged code.

Is there a pbvm.dll C# wrapper somewhere around? It would significantly speed up the solution.

There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 15 February 2023 20:13 PM UTC
  2. PowerBuilder
  3. # 2

Hi Tomas;

  The PB runtime does NOT provide "Calling Stack" access to your PB App.

   BTW: There is already an enhancement request into Engineering for this feature.

Regards .. Chris

  1. John Fauss
  2. Wednesday, 15 February 2023 20:50 PM UTC
I'm confused, Chris... If the PB runtime provides app access to the call stack, why is there an enhancement request? If so, how, or did you mean "does not"? Maybe another mug full of coffee is needed ;) lol
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 15 February 2023 21:00 PM UTC
Hi John ... it does not.

You could run an App trace though & parse the output for that but, it would not be an easy parsing job. :-(
  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.