You can store the objects used in your PocketBuilder application in more than one library and, when you run the application, dynamically load any objects that are not contained in the application's executable file. This allows you to break the application into smaller units that are easier to manage and makes the executable file smaller. You do this by using dynamic libraries. PocketBuilder builds PocketBuilder dynamic libraries (PKD files).
If you decide to use a dynamic library, you need to tell PocketBuilder which PocketBuilder library (PKL file) to create it from. PocketBuilder then places compiled versions of all objects from that PKL file into a PKD file with the same name. For example, the dynamic library built from test.pkl is named test.pkd.
When PocketBuilder builds a dynamic library, it copies the compiled versions of all objects from the source PKL file into the dynamic library.
The easiest way to specify source libraries is simply to use your standard PocketBuilder libraries as source libraries. However, using this technique can make your dynamic libraries larger than they need to be, because they include all objects from the source library, not just the ones used in your application. You can create a PocketBuilder library that contains only the objects that you want in a dynamic library.
To create a source library to be used as a dynamic library:
In the Library painter, place all the objects that you want in the dynamic library in one standard PKL file.
If you need to create a new PKL file, select Entry>Library>Create from the menu bar, then drag or move the objects into the new library.
Make sure the application's library search path includes the new library.
Multiple dynamic libraries You can use as many dynamic libraries as you want in an application. To do so, create a separate PKL file source library for each of them.
When you define your project, you tell PocketBuilder which of the libraries in the application's library search path will be dynamic by checking the PKD check box next to the library name in the Project painter.
When building a dynamic library, PocketBuilder does not inspect the objects; it simply copies the compiled form of the objects into the dynamic library. Therefore, if any of the objects in the library use resources (pictures and icons)—either specified in a painter or assigned dynamically in a script—and you do not want to provide these resources separately, you must list the resources in a PKR file. Doing so enables PocketBuilder to include the resources in the dynamic library when it builds it.
To reference additional resources:
List the resources in a PKR file.
How to list the resources is described in “Distributing resources”.
Use the Resource File Name box in the Project painter workspace to reference the PKR file in the dynamic library.