Mastering PowerBuilder

HomePrevious Lesson: Course 3:: Session 25 :: Page 50
Next Lesson: Course 3:: Session 25 :: Page 70
Dynamic Linked Libraries

In the DOS world, when you create an executable file, everything in the application goes into a single application. This is called as Static linking and it creates a single large executable. When you run the application, the whole executable loads into the memory. In the MS-Windows world, you can create one small executable and the rest as DLLs. When you create DLLs, the operating system loads the DLL in the memory. as and when it is required by the application. Another advantage is that, if the functionality of a DLL is required by multiple applications, MS-Windows doesn’t load multiple copies of the same DLL, instead, the loaded DLL is shared among the applications. And also, a DLL can be called by any application, for example, we called few Windows API functions from PowerBuilder applications. Those DLLs we called are Windows DLLs. That means, more applications can share your application’s functionality, that too without loading the whole executable in the memory. When none of the application is referencing a DLL, MS-Windows automatically unloads the DLL from the memory.

As described above, when you choose P-Code, PowerBuilder generates PowerBuilder DLLs with ".PBD" extension. PBD is the acronym for PowerBuilder Dynamic Linked Library. Unlike other DLLs where any application can make a call to the DLLs, PowerBuilder DLLs (.PBD files) can’t be shared by non-PowerBuilder applications. These are proprietary. Other than that, you can utilize every advantage of the DLL. Generating the P-code yields two things. One executable and one PBD for each PowerBuilder library.

Depending on the way an Application is structured, the objects in an Application may be distributed in one or more dynamic libraries. An application may be partitioned in response to on or more of the following reasons.
Maintenance: They enable you to deliver your application components separately. That means when you need to provide users with an upgrade or bug fix, you don't have to redistribute the entire application, you can just give them the particular dynamic library that was affected.
Reusability: They make it possible for multiple applications to reuse the same components. That's because dynamic libraries can be shared among applications as well as among users.
Modularity: They let you break up your application into smaller, more modular files that are easier to manage.
Flexibility: They enable you to provide your application with objects that it references only dynamically at execution time (such as a window object referenced only through a string variable). You can't put such objects in your executable file (unless they are DataWindow objects). If you choose to put everything in an executable, PowerBuilder doesn’t copy objects that are referenced dynamically. If you choose to create DLLs/PBDs, PowerBuilder copies everything that is in the development library to the DLL/PBD.
Class Libraries: Use of Foundation class Libraries or Application Frameworks
Size: The size of an executable file should not be more than 1.5 megabytes. If it approaches that size, dynamic libraries should be used
Performance: They can help a large application use memory efficiently because: PowerBuilder doesn't load an entire dynamic library into memory at once. Instead, it loads individual objects from the dynamic library only when needed. Your executable file can remain small, making it faster to load and less obtrusive.

HomePrevious Lesson: Course 3:: Session 25 :: Page 50
Next Lesson: Course 3:: Session 25 :: Page 70