Compiler basics
When you plan an application, one of the fundamental topics
to think about is the compiler format in which you want that application
generated. PowerBuilder offers two alternatives: Pcode and machine
code.
Pcode
Pcode (short for pseudocode) is an interpreted language that
is supported on all PowerBuilder platforms. This is the same format
that PowerBuilder uses in libraries (PBL files) to store individual
objects in an executable state. Advantages of Pcode include its
size, reliability, and portability.
Machine code
PowerBuilder generates and compiles code to create a machine
code executable or dynamic library. The key advantage of machine
code is speed of execution.
PowerBuilder DLLs cannot be called
PowerBuilder machine code DLLs cannot be called from other
applications.
Deciding which one to use
Here are some guidelines to help you decide whether Pcode
or machine code is right for your project:
-
Speed
If your application does intensive script processing, you
might want to consider using machine code. It will perform better
than Pcode if your code makes heavy use of looping constructs, floating
point or integer arithmetic, or function calls. If your application
does not have these characteristics, machine code does not perform
noticeably better than Pcode. If you think your application might
benefit from the use of machine code, perform some benchmark testing
to find out.Pcode is faster to generate than machine code. Even if you
plan to distribute your application using machine code, you might
want to use Pcode when you want to quickly create an executable
version of an application for testing. -
Size
The files generated for Pcode are smaller than those generated
for machine code. If your application is to be deployed on computers
where file size is a major issue, or if you deploy it using a Web
download or file transfer, then you might decide to give up the
speed of machine code and choose Pcode instead.