1. Wei Yan
  2. PowerBuilder
  3. Friday, 11 October 2019

I'm new to PowerBuilder development. I started working on a legacy system, which was recently upgraded to PB 2017 and OS is window 10.  

I can build / deploy / run EXE runs perfectly.  However, when I run / debug in IDE then I got  Error saying - Bad runtime function reference at line ** in function *****.  this is throw at a function call which is in a C++ DLL.

DLL and EXE are in the same folder.

----- below is PowerBuilder source code -----------------

function int feGetDLLInfo( ... ) libarary "lc_felmi.dll" alias for "feGetDLLInfo:Ansi"

-------------------------------------------------------------------

I really want to know if anything can be done to enable the debug capability.

 

Thanks!

 

 

 

 

 

 

Who is viewing this page
Accepted Answer
Michael Kramer Accepted Answer Pending Moderation
1
Votes
Undo

Hi,

"Bad runtime function reference" likely happens because .DLL file must be in app's start folder (or in path). Your stand-alone compiled version succeeds because you put .DLL file in same folder as app's .EXE file.

App's folder when you run/debug from PowerBuilder IDE may be different than you expect. Example:

My target file is C:\DEV\Demo\Demo.pbt
My app object is app_demo
Library containing app_demo is C:\DEV\Demo\Main\Main.pbl

In this setup your .DLL file must be C:\DEV\Demo\Main\lc_fermi.dll

HTH /Michael

Comment
Hi Michael -



Thank you for looking into it!



You are right! I finally found out that working directory is specified in pb.ini and PB 2017 installation by default set it as WorkingDir=C:\Program Files (x86)\Appeon\PowerBuilder 17.0



I managed to change this setting in pb.ini and it is working.



Thank you so much!!!



Wei

  1. Wei Yan
  2. Friday, 11 October 2019
Well, - or - as you found out - place .DLL file in a folder that Windows PATH includes. I deliberately didn't mention this alternate solution - BUT you found it yourself!
  1. Michael Kramer
  2. Monday, 14 October 2019
There are no comments made yet.
  1. Friday, 11 October 2019
  2. PowerBuilder
  3. # Permalink
Wei Yan Accepted Answer Pending Moderation
1
Votes
Undo

The problem is resolved by changing WorkingDir setting in pb.ini 

 

Thank you Michael!

Thank you all !

Comment
There are no comments made yet.
  1. Friday, 11 October 2019
  2. PowerBuilder
  3. # 1
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

It isn't possible to debug into the DLL from PowerBuilder.

 

If one of the arguments is a Ref String, you must pre-allocate it using the Space() function. Something like:

ls_output = Space(250)

ll_rc = extFunc(ls_output)

 

Comment
Sorry for having you confused.



I don't expect to debug into DLL. The problem I'm facing is when I run PB application in IDE, it crashed at the point of invoking functions from this DLL.



Thanks,



Wei
  1. Wei Yan
  2. Friday, 11 October 2019
There are no comments made yet.
  1. Friday, 11 October 2019
  2. PowerBuilder
  3. # 2
0
Votes
Undo

HI

Do you have the lc_felmi.dll installed on your development machine?

Regards

David

Comment
Hi David -



Thanks for looking into it !



This is a desktop PB application and everything is loaded locally. All c++ DLLs are simply put in same folder where PB libraries and EXE are deployed.



The object name from pbl that contains main window to run the application is called prod_dev. the EXE created by deployment is called prodspec.exe ( sorry if couldn't explain my challenge properly because I'm still new to PB terminology ).



If I run prodspec.exe, no problem.



If I debug through IDE, I got error. the workspace I opened in IED is prod_specifications.pbw, which is also in this folder. Looks to me everything I need is in this folder.



Thanks,



Wei









  1. Wei Yan
  2. Friday, 11 October 2019
When compiled and deployed lc_felmi.dll is located in same folder as app's .EXE + .PBD files.

When you debug or run from PowerBuilder IDE, you must locate your .DLL in same folder as your .PBT + .PBL files. If they are in different subfolders then in same folder as the .PBL file containing your application object.

HTH /Michael
  1. Michael Kramer
  2. Friday, 11 October 2019
There are no comments made yet.
  1. Friday, 11 October 2019
  2. PowerBuilder
  3. # 3
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

Just a wild guess but if the intent of the function is to return version info about another DLL, I have an example of how to do that:

http://www.topwizprogramming.com/freecode_osversion.html

 

Comment
Hi Roland -



Thanks for looking into it.



It is just one of many functions from DLL to run PB application.



Any tip is appreciated! Thank you for your sharing.



Wei
  1. Wei Yan
  2. Friday, 11 October 2019
There are no comments made yet.
  1. Friday, 11 October 2019
  2. PowerBuilder
  3. # 4
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Wei;

   PowerBuilder does not use any runtime method named "feGetDLLInfo" or the DLL "lc_felmei.dll". From what I Google, this library is an old VS 2003 library that can be called externally.

      My guess is that your App has some code that states ...

#IF Debug then

  //   Call the above DLL method

#End IF

That is why your app works from the IDE & as an EXE until you set the "Debug" parameter on in your Project Object before you compile.

FWIW: I have no idea what this DLL / Method would be used for. However, Googling it shows problems with this DLL way back in the PB 8 days and subsequent releases where this is called. A few threads mention this issue was fixed by fixing missing pieces from the .Net 1.0 framework.

Regards ... Chris

Comment
Hi Chris -



Thanks for looking into it !



This DLL is in-house DLL which is shared by this PB application.



Thanks,



Vivian
  1. Wei Yan
  2. Friday, 11 October 2019
If you are migrating from a PB version n ANSI version of PB. Since PB v10.0 and higher, the PB environment is not only 32 & 64 bit but also Unicode. That could spell some data alignment & length issues for your in-house older DLL.
  1. Chris Pollach
  2. Friday, 11 October 2019
There are no comments made yet.
  1. Friday, 11 October 2019
  2. PowerBuilder
  3. # 5
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.