Establishment of the implementation document
1, the choice of compiling format
PowerBuilder 8.0 provides two compilation formats for generating executables: pseudocode (Pcode, abbreviated as PSEUDOCODE) and machine code (MACHINECODE). Pseudocode is an interpretive language that is supported on all PowerBuilder platforms in a format that, like the PowerBuilder runtime (. PBL), saves a single object in an executable state with the advantage of being convenient and portable The machine code is a real executable that completely detached from the PowerBuilder environment, with the advantage of being fast, but with a large file capacity. Choosing a compiled code format is generally based on the following three aspects:
① speed. Select Machine code if the goal is to optimize the speed of the operation and apply hardening script processing. If the code uses more loops, floating-point, or integer algorithms and function calls, the machine code will do better than the pseudo code. However, pseudocode compiles faster than machine code, especially when developers are quick to create test executable files;
② size. Pseudocode generates a smaller file than machine code. If the terminal machine running the application is tense, it is necessary to discard the faster machine code and choose Pseudo Code;
③ transplant. Pseudo-code is useful for Cross-platform applications. It can be easily used across platforms (PowerBuilder support), including Microsoft Windows (16-bit and 32-bit), Applemacintosh, and UNIX. Machine code is platform-dependent, which means that the build is consistent with the executable application platform, but it can achieve better performance.
2, the establishment of dynamic library
Publishing PowerBuilder 8.0 applications can put some objects in the executable file, and in a dynamic library to run fashion, so that the application can be split into smaller modules for easy management and maintenance.
Select Pseudo Code (PCODE) Compile method to generate PowerBuilder dynamic library (. pbd file), select Machine Code (MACHINECODE) To build a dynamic link library (. dll files, such as compiling TEST.PBL into Test.dll) on Windows and UNIX platforms, generating platform-supported shared libraries (such as Test.lib) on the machine platform. If you have two applications on Windows, the. PBD contains a user object that invokes the global external function, in order to ensure that the correct call function must compile and publish the. pbd file separately for each application.
When a dynamic library is established, copies the compiled versions of all objects in the source Library (. pbl file) to the dynamic library. In order to use only the objects you want in some libraries, you can place them in a standard PowerBuilder library (. PBL).
When creating a dynamic library, PowerBuilder does not check all objects, but simply removes the source formatting of the object, so for some objects that specify the use of resources (graphics, icons, or pointers) in the brush or script, if you do not want to provide a separate resource, You must list these resources in the resource file (. pbr) in order to ensure that the resources are included when you build the dynamic library.
There are two ways to build a dynamic library: one is to build in the library management brush, and the other is to build the project object in the engineering brush.