1. Gunnar Gisleberg
  2. PowerBuilder
  3. Thursday, 3 June 2021 08:06 AM UTC

Hi

Our application development is based on 2019 r3. I ran into a crash/exception running the application. The crash occurs in the C external function defined as :

function long ShellExecuteA( ulong hWnd, string Operation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd ) LIBRARY "shell32.dll" alias for "ShellExecuteA;Ansi"

Error number: 21

Bad runtime reference at line ..

 

The crash/exception seems be related to the build 

- I one case the program feiled after a complete rebuild

- after a second fulll rebuild the program worked ok again

 

The description found in the appeon community is like this

0
Votes

Bad runtime function reference means, that there the called function is not found at the expected (internal) place in the compiled code. Usually a full build solves the problem.

I have not detected how to control this issue - a single full build does not help to avoid this problem.

Is there any experience / advice how to avoid this issue?

The function is defined in the main program as an external function - is there an alternate implementation ?

For example - is it more robust to create a .net assembly and execute the functions from an imported dll in pb 2019?

Regards

Gunnar Gisleberg

Locus Solutions AS

 

Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 3 June 2021 12:42 PM UTC
  2. PowerBuilder
  3. # 1

It would work better using ShellExecuteW since PB strings are Unicode.

I have a working example here:

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

It uses ShellExecuteExW which passes arguments in a structure.

Comment
  1. Gunnar Gisleberg
  2. Friday, 4 June 2021 05:40 AM UTC
Thank you. I shall check this implementation
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.