PBORCA_ExecutableCreate
Description
Creates a PowerBuilder executable with Pcode or machine code. For a
machine code executable, you can request several debugging and
optimization options.
The ORCA library list is used to create the application. You can
specify which of the libraries have already been built as PBDs or DLLs and
which will be built into the executable file.
Syntax
|
1 2 3 4 5 6 7 8 9 10 |
INT PBORCA_ExecutableCreate ( HPBORCA hORCASession, LPTSTR lpszExeName, LPTSTR lpszIconName, LPTSTR lpszPBRName, PBORCA_LNKPROC pLinkErrProc, LPVOID pUserData, INT FAR *iPBDFlags, INT iNumberOfPBDFlags, LONG lFlags, LPVOID pbcPara = NULL ); |
|
Argument |
Description |
|---|---|
|
hORCASession |
Handle to previously established ORCA |
|
lpszExeName |
Pointer to a string whose value is the name of the |
|
lpszIconName |
Pointer to a string whose value is the name of an |
|
lpszPBRName |
Pointer to a string whose value is the name of a |
|
pLinkErrProc |
Pointer to the PBORCA_ExecutableCreate callback The information ORCA passes to the callback If you don’t want to use a callback |
|
pUserData |
Pointer to user data to be passed to the The user If |
|
iPBDFlags |
Pointer to an array of integers that indicate which
|
|
iNumberOfPBDFlags |
The number of elements in the array iPBDFlags, which |
|
lFlags |
A long value whose value indicates which code Setting lFlags to 0 generates a native Setting lFlags to PBORCA_X64 |
|
pbcPara |
Reserved for internal use. Always set pbcPara to |
Return value
INT. Typical return codes are:
|
Return code |
Description |
|---|---|
|
0 PBORCA_OK |
Operation successful |
|
-1 PBORCA_INVALIDPARMS |
Invalid parameter list |
|
-5 PBORCA_LIBLISTNOTSET |
Library list not set |
|
-12 PBORCA_LINKERROR |
Link error |
|
-13 PBORCA_CURRAPPLNOTSET |
Current application not set |
Usage
You must set the library list and current Application object before
calling this function.
For more information about various options for building executables,
see the PowerBuilder User’s Guide.
Libraries used in the executable
The executable being built incorporates the objects in the libraries
on ORCA’s library list. The library list must be set by calling
PBORCA_SessionSetLibraryList before creating an executable.
The iPBDFlags argument lets you specify which libraries are PBDs and
which will be built into the executable file. In the iPBDFlags array, each
integer is associated with a library on ORCA’s library list. When you set
an integer to 1, the objects in the corresponding library are already
built into a PBD file (if you are generating Pcode) or a PowerBuilder DLL
(if you are generating machine code). Objects in libraries whose integer
flag is set to 0 will be built into the main executable file.
Before you call PBORCA_ExecutableCreate, you must call
PBORCA_DynamicLibraryCreate to create the PBDs or DLLs that you identify
in the iPBDFlags array.
Setting code generation options
In the lFlags argument, you can set various machine code generation
options by setting individual bits. The following table shows what each
defined bit means in the long value and what constants to use in a bitwise
OR expression to set the option. Bits not listed are reserved.
|
Bit |
Value and meaning |
Constant to include in ORed expression |
|---|---|---|
|
0 |
0 = Pcode 1 = Machine code |
To get machine code, use PBORCA_MACHINE_CODE or |
|
1 |
0 = Native code 1 = 16-bit |
To get 16-bit machine code, use PBORCA_MACHINE_CODE To get 16-bit Pcode, use Not supported after PowerBuilder PowerBuilder no longer supports the Windows 3.x |
|
2 |
0 = No Open Server 1 = Open |
To build an Open Server executable, use Not supported after PowerBuilder The OpenClientServer driver was no longer supported |
|
4 |
0 = No trace information 1 = Trace |
To get trace information, use |
|
5 |
0 = No error context 1 = Error |
To get error context information, use Error context provides the script |
|
8 |
0 = No optimization 1 = |
See Bit 9 |
|
9 |
0 = Optimize for speed 1 = Optimize for |
To optimize the executable for speed, use To optimize the |
|
10 |
0 = Old style visual controls 1 = New |
PBORCA_NEW_VISUAL_STYLE_CONTROLS |
|
12 |
1 = PocketBuilder desktop |
PBORCA_PK_DESKTOP (Obsolete) |
|
13 |
1 = PocketBuilder ARM |
PBORCA_PK_PPCARM (Obsolete) |
|
14 |
1 = PocketBuilder EM86 |
PBORCA_PK_PPCEM86 (Obsolete) |
|
15 |
1 = PocketBuilder X86 |
PBORCA_PK_PPCX86 (Obsolete) |
|
16 |
1 = PocketBuilder Smartphone ARM |
PBORCA_PK_SPHONEARM (Obsolete) |
|
17 |
1 = PocketBuilder Smartphone X86 |
PBORCA_PK_SPHONEX86 (Obsolete) |
To generate Pcode, lFlags must be 0. The other bits are not
relevant:
|
1 |
lFlags = PBORCA_P_CODE; |
To set the lFlags argument for various machine-code options, the bit
flag constants are ORed together to get the combination you want:
|
1 2 3 |
lFlags = PBORCA_MACHINE_CODE | PBORCA_MACHINE_CODE_OPT | PBORCA_MACHINE_CODE_OPT_SPACE; |
Constants are defined in PBORCA.H for typical option combinations.
They are:
PBORCA_MACHINE_DEFAULT
Meaning native machine code optimized for speed
Equivalent to:
|
1 2 |
PBORCA_MACHINE_CODE | PBORCA_MACHINE_CODE_OPT_SPEED |
PBORCA_MACHINE_DEBUG
Meaning native machine code with trace information and error context
information
Equivalent to:
|
1 2 |
PBORCA_MACHINE_CODE | PBORCA_TRACE_INFO | PBORCA_ERROR_CONTEXT |
eClobber setting
If the executable file already exists in the file system, the
current setting of the eClobber property in the ORCA configuration block
(that you set with a PBORCA_ConfigureSession call) determines whether
PBORCA_ExecutableCreate succeeds or fails.
|
Current eClobber setting |
PBORCA_ExecutableCreate |
|---|---|
|
PBORCA_NOCLOBBER or |
Fails when an executable file already exists in the |
|
PBORCA_CLOBBER |
Succeeds when the existing executable file has |
|
PBORCA_CLOBBER_ALWAYS |
Succeeds regardless of the file attribute settings of |
Examples
This example builds a native machine code executable optimized for
speed using ORCA’s library list and current application. Suppose that the
current ORCA session has a library list with four entries. The example
generates DLLs for the last two libraries.
The callback function is called LinkErrors, and lpUserData points to
an empty buffer to be populated by the callback function:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
LPTSTR pszExecFile; LPTSTR pszIconFile; LPTSTR pszResourceFile; int iPBDFlags[4]; long lBuildOptions; int rtn; fpLinkProc = (PBORCA_LNKPROC) LinkProc; // specify file names pszExecFile = _TEXT("c:\app\process.exe"); pszIconFile = _TEXT("c:\app\process.ico"); pszResourceFile = _TEXT("c:\app\process.pbr"); iPBDFlags[0] = 0; iPBDFlags[1] = 0; iPBDFlags[2] = 1; iPBDFlags[3] = 1; lBuildOptions = PBORCA_MACHINE_CODE_NATIVE | PBORCA_MACHINE_CODE_OPT_SPEED; // create executable rtn = PBORCA_ExecutableCreate( lpORCA_Info->hORCASession, pszExecFile, pszIconFile, pszResourceFile, fpLinkProc, lpUserData, (INT FAR *) iPBDFlags, 4, lBuildOptions, NULL ); |
For more information about setting up the data buffer for the
callback, see Content of a
callback function and the example for PBORCA_LibraryDirectory.
In these examples, session information is saved in the data
structure ORCA_Info, shown in About the examples.
See also