1. ATK Gimmy Susan
  2. PowerBuilder
  3. Friday, 5 June 2020 09:52 AM UTC

 

hello Guru

I am implementing the dynamic addition of PBL to my running program.

In particular, I add 3 libraries in one shot.

 

[code]

ls_ = GetLibraryList ( )

ls_temp = ls_pbl+","+ls_

li = Setlibrarylist(ls_temp)

[end code]

This is the result.

 

As you can see the reference to the * .EXE is repeated.
Correct that it works like this?

 

Thanks in advance for your reply

Gimmy

 

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 20:41 PM UTC
  2. PowerBuilder
  3. # Permalink

Gimmy, from your most recent post (I added the red outlines):

The first MessageBox shows the GetLibraryList() results, and the list begins with the exe, because as Richard said, this is way it has to be at execution time.

You then added pbl's to the beginning of the list without first removing the exe from the list, then pass that to SetLibraryList(). Since the list you supplied does not begin with the exe as it has to at execution time, PB prefaces the list you supplied with the exe... so now it is present in the list twice. This is why you are seeing what you are seeing.

If you have to/need to add PBL's to the beginning of the list and you want to correct this, you're going to have to parse and remove the exe from the list returned by GetLibraryList() BEFORE you set the new list.

HTH, John

Comment
  1. Ricardo Jasso
  2. Friday, 5 June 2020 22:05 PM UTC
There is no need to remove the exe from the new list. It will be ignored if included. From the help: "The executable file is always first in the library search path. If you include it in filelist, it is ignored."



I think Gimmy is pointing this out because he wants to override an object that resides in the executable. The only way to do that is to extract the object from the application pbl and place it in a different one.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 5 June 2020 23:21 PM UTC
Hi Ricardo ... That's why I said that you should "never" include objects in the EXE. They should all come from PBD's. Then adding a library to the beginning will definitely pickup the alternate object of the same name. ;-)
  1. Helpful
There are no comments made yet.
Ricardo Jasso Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 18:05 PM UTC
  2. PowerBuilder
  3. # 1

PowerBuilder will always search first in the executable file for an object that it needs to load and then in the files listed in the library list. That's why GetLibraryList always shows it at the top.

If you need to override an object that exists in the exe file then I'd suggest you move the original object to a new pbl and put it just below the pbl that contains the application object. Then do what you are doing and the new object will be placed above the original object, but still below the aplication object.

 

Comment
  1. Chris Pollach @Appeon
  2. Friday, 5 June 2020 18:31 PM UTC
Hi Ricardo ... That is why you should NEVER link any objects into an EXE (except the APP object which is by default). That way, when you add a PBL(s) to the front of the library list, the objects found there will be taken first. ;-)
  1. Helpful
There are no comments made yet.
ATK Gimmy Susan Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 17:35 PM UTC
  2. PowerBuilder
  3. # 2

THIS is the code. It is very simple.

I add the messagebox for show you the problem.

==========

string ls_temp, ls_,ls_pbl
integer li


if isnull(ls_pbl) or trim(ls_pbl) = '' Then return -1

ls_ = GetLibraryList ( )
messagebox('Ls_', ls_)

ls_temp = ls_pbl+","+ls_
messagebox('Ls_temp', ls_temp)

li = Setlibrarylist(ls_temp)
messagebox('Li', string(li))

ls_ = GetLibraryList ( )
messagebox('Ls_', ls_)

 

 

 

This is the messagebox

==============

The original library list

 

The new list

 

The return code

 

The new library list ( the exe is twice )

 

 

Comment
  1. mike S
  2. Friday, 5 June 2020 18:47 PM UTC
ls_pbl is what you need to show



  1. Helpful
There are no comments made yet.
ATK Gimmy Susan Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 17:16 PM UTC
  2. PowerBuilder
  3. # 3

Hi Chris.
Where did you find the 2328 ?

i have:

Comment
  1. Chris Pollach @Appeon
  2. Friday, 5 June 2020 17:29 PM UTC
Build 2328 reflects the install of the 1st Maintenance Release (MR2328) over top of the PB 2019 R2 GA (build 2323).

FYI ... https://docs.appeon.com/appeon_online_help/pb2019r2/release_bulletin_for_pb/bug_fixes.html

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 16:29 PM UTC
  2. PowerBuilder
  3. # 4

Hi Gimmy;

   FYI:  I just did a test using my STD framework that logs the library list in the App's log by default. I changed the code to test the updating of the library list using a SetLibrayList(). In my test of the compiled 32bit P-Code App EXE, the EXE name only appears once afterwards, as follows:

  Note that my test was done using PB2019 R2 build 2328.

HTH

Regards ... Chris

Comment
  1. ATK Gimmy Susan
  2. Friday, 5 June 2020 17:36 PM UTC
How do you do that.

=)
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 5 June 2020 19:36 PM UTC
Magic ;-)
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 16:25 PM UTC
  2. PowerBuilder
  3. # 5

that is not right. if the exe is duplicated its either a bug in whatever version you are running or more likely you put it in ls_pbl

 

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 14:57 PM UTC
  2. PowerBuilder
  3. # 6

Hi Gimmy;

  If you are only adding libraries to your current App's library list, then you might want to use the  AddToLibraryList () command instead.

HTH

Regards ... Chris

Comment
  1. ATK Gimmy Susan
  2. Friday, 5 June 2020 15:26 PM UTC
Hi Chris



from manual:

[omissin] Calling AddToLibraryList APPENDS a new list of files [omissis]

i need to add the PBL at the TOP



=)





  1. Helpful
  1. Roland Smith
  2. Friday, 5 June 2020 18:16 PM UTC
The only reason to have it at the top is if the objects are duplicates - overriding ones in the existing library list.
  1. Helpful
  1. Roland Smith
  2. Friday, 5 June 2020 18:17 PM UTC
Also, make sure you are doing this in the application open event.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 5 June 2020 13:39 PM UTC
  2. PowerBuilder
  3. # 7

I think I would have to see what GetLibraryList() returned as well as the return code from SetLibraryList() before being able to answer your question. There's No way to tell from the limited amount of runtime information you have supplied.

Comment
  1. ATK Gimmy Susan
  2. Friday, 5 June 2020 15:26 PM UTC
I have no error in return code, but it quite stange that i have twice exe.
  1. Helpful
  1. John Fauss
  2. Friday, 5 June 2020 16:17 PM UTC
I did not take note that it was the EXE that was listed twice. This now makes sense to me, as the exe probably has to be the very first item listed even though it technically is not a "library"... because the exe contains resources that may need to be accessed. Therefore, it appears that yes, PB always prefixes the library list of PBL's you set with the path & name of the exe. That what it looks like is happening. Since you did not display the value returned by the GetLibraryList() function, we cannot say for sure. This is the point I was attempting to make.



If you're going to manipulate the library list in this manner, it appears you will need to strip off the exe from the GetLibraryList response before you preface the list with your other libraries.
  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.