Description
Creates a PowerBuilder dynamic library (PBD) or PowerBuilder DLL.
Syntax
INT PBORCA_DynamicLibraryCreate ( HPBORCA hORCASession, LPTSTR lpszLibraryName, LPTSTR lpszPBRName, LONG lFlags, LPVOID pbcPara = NULL );
Argument |
Description |
---|---|
hORCASession |
Handle to previously established ORCA session. |
lpszLibraryName |
Pointer to a string whose value is the file name of the library to be built into a PBD or DLL. |
lpszPBRName |
Pointer to a string whose value is the name of a PowerBuilder resource file whose objects you want to include in the PBD or DLL. If the application has no resource file, specify 0 for the pointer. |
lFlags |
A long value that indicates which code generation options to apply when building the library. Setting lFlags to 0 generates a native Pcode executable. For information about setting machine code generation options, see PBORCA_ExecutableCreate |
pbcPara |
Reserved for internal use. Always set pbcPara to NULL. |
Return value
INT. The typical return codes are:
Return code |
Description |
---|---|
0 PBORCA_OK |
Operation successful |
-1 PBORCA_INVALIDPARMS |
Invalid parameter list |
-4 PBORCA_BADLIBRARY |
Bad library name |
-17 PBORCA_PBDCREATERROR |
PBD create error |
Usage
Before calling this function, you must have previously set the library list and current application.
If you plan to build an executable in which some of the libraries are dynamic libraries, you must build those dynamic libraries before building the executable.
Location and name of file
The resulting PBD or DLL will be created in the same directory using the same file name as the PBL. Only the extension changes. For example, for a library C:\DIR1\DIR2\PROG.PBL:
-
The output for Pcode is C:\DIR1\DIR2\PROG.PBD
-
The output for machine code is C:\DIR1\DIR2\PROG.DLL
eClobber settings
If the PBD or DLL 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_DynamicLibraryCreate succeeds or fails.
Current eClobber setting |
PBORCA_DynamicLibraryCreate |
---|---|
PBORCA_NOCLOBBER |
Fails when an executable file already exists in the file system, regardless of the file attribute settings |
PBORCA_CLOBBER or PBORCA_CLOBBER_DECIDED_BY_SYSTEM |
Succeeds when the existing executable file has read-write attributes; fails when the executable file has read-only attributes |
PBORCA_CLOBBER_ALWAYS |
Succeeds regardless of the file attribute settings of an existing executable file |
Examples
This example builds a machine code DLL from the library PROCESS.PBL. It is optimized for speed with trace and error context information:
LPTSTR pszLibFile; LPTSTR pszResourceFile; long lBuildOptions; int rtn; // copy file names pszLibFile = _TEXT("c:\\app\\process.pbl"); pszResourceFile = _TEXT("c:\\app\\process.pbr"); lBuildOptions = PBORCA_MACHINE_CODE_NATIVE | PBORCA_MACHINE_CODE_OPT_SPEED | PBORCA_TRACE_INFO | PBORCA_ERROR_CONTEXT; // create DLL from library rtn = PBORCA_DynamicLibraryCreate( lpORCA_Info->hORCASession, pszLibFile, pszResourceFile, lBuildOptions, NULL );
In these examples, session information is saved in the data structure ORCA_Info, shown in About the examples.
See also