Kbase 15806: HLC: How to build a Windows Progress client with C functions
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/10/2008 |
|
Status: Verified
GOAL:
HLC: How to build a Windows Progress client with C functions
GOAL:
How to build a Progress executable containing selfdefined C functions
GOAL:
How to implement hlc.h library when using HLC - ESQL/C
GOAL:
How to build a Progress client with C functions.
FACT(s) (Environment):
MS-Windows
FIX:
This solution is a guideline on how to build a Progress executable containing C functions written by the user. For complete information it is strongly recommended that you refer to the PROGRESS manuals, Release Notes and README files.
This information applies to V6, V7 and V8. Any differences are noted.
1) REQUIREMENTS
To build PROGRESS clients, you need the appropriate PROGRESS license, a C compiler and a linker.
You can use the following compilers:
V6.2M (Commercial) C600, C700
V6.2M05 (Commercial) C600, C700, Visual C/C++ V1.0
V6.2M13 (Commercial) C600, C700, Visual C/C++ V1.0
V6.2M16 (Patch) C600, C700, Visual C/C++ V1.0
V6.2M18 (Commercial) or LATER C600, C700, Visual C/C++ V1.0, V1.5
V7 (any) Visual C++ V1.0, V1.5
V8.0/V8.1 Visual C++ V1.0, V1.5
V8.2/V8.3 Visual C++ V4.2, V5.0
Microsoft Visual C++ 2.0 and later are not supported for V6 and V7 because they are 32 bit products.
2) WORKING ENVIRONMENT
2.1) VERSION 6
You may create a working directory to place your source and compiled files. Don't use the PROGRESS DLC directory in order to avoid risks of accidentally altering the original PROGRESS files.
Because the link script built by PROBUILD doesn't include a complete path to the objects in DLCLOAD/4GL and DLCLOAD/EUCAPP directories, you may choose between copying these directories to your working directory or modifying the link script to add the full path to all of these files.
You need the normal environment variables (DLC, PROPATH, PATH,...) to run Progress sessions from Windows. But for probuilding, compiling and linking you need to be especially careful with the following ones:
DLC Points to the Progress DLC directory.
PROLOAD Points to the Progress DLCLOAD directory.
PROPATH Includes DLCLOAD/EUCAPP directory and DLCLOAD/EUCAPP/EUC.PL
library file.
LIB Points to the C LIB directory.
INCLUDE Points to the C INCLUDE directory.
PATH Includes Progress DLC directory.
PROEXE Points to the current Progress executable.
Example:
set DLC=C:\62M22\DLC
set PROLOAD=%DLC%LOAD
set PROPATH=%DLC%;%PROLOAD%\EUCAPP;%PROLOAD%\EUCAPP\EUC.PL
set LIB=C:\MSVC\LIB
set INCLUDE=C:\MSVC\INCLUDE
set PATH=%PATH%;%DLC%;%DLC%\BIN
2.2) VERSIONS 7 AND 8
You may create a working directory to place your source and compiled files. Don't use the PROGRESS DLC directory in order to avoid risks of accidentally altering the original PROGRESS files.
Put in this directory a PROGRESS.INI with the normal settings for your PROGRESS sessions. You must pay special attention to the PROBUILD and PROPATH parameters. PROBUILD must point to the Progress DLC/PROBUILD directory and PROPATH must include the DLC\PROBUILD\EUCAPP directory and DLC\PROBUILD\EUCAPP\EUC.PL library file.
Example:
PROBUILD=C:\DLC\PROBUILD
PROPATH=.,C:\DLC,C:\DLC\PROBUILD\EUCAPP,C:\DLC\PROBUILD\EUCAPP\EUC.PL
Additionally, because the compiling and linking must be done from the DOS prompt, you will need to set DOS LIB and INCLUDE environment variables. LIB must point to the C LIB directory and INCLUDE to the C INCLUDE directory.
Example:
set LIB=C:\MSVC\LIB
set INCLUDE=C:\MSVC\INCLUDE
3) C PROGRAM
You can include your C functions in one or more C programs. If you are going to use HLC library functions, you must include the HLC.H header file. This file is located in DLCLOAD\HLC directory in V6, or DLC\PROBUILD\HLC directory in V7/V8. If you are going to use Embedded SQL functions, you must include the PROESQL.H header file. This file is located in DLCLOAD\ESQL directory in V6, or DLC\PROBUILD\ESQL directory in V7/V8.
Example of C program "mytest.c":
#include "C:/dlcload/hlc.h" /* if V6 */
#include "C:/dlc/probuild/hlc/hlc.h" /* if V7 V8 */
int mytest (int argc, char *argv[]) {
promsgd("Hola Emeanos");
. return 0;
}
4) HLPRODSP
C functions and PROPRESS functions may not have the same name. There is a file, hlprodsp.c, which translates 4GL calls into C function names. You must create and compile this file specifying the names you are using. An example of it is in DLCLOAD\HLC directory (V6) or DLC\PROBUILD\HLC directory (V7/V8).
Example of "hlprodsp.c" file:
#define FUNCTEST(nam, rout) \
if (strcmp(nam, pfunnam) == 0) \
return rout(argc,argv);
long PRODSP(pfunnam, argc, argv)
char *pfunnam; /* Name of function to call */
int argc;
char *argv[];
{
FUNCTEST("HOLA",mytest);
return 1;
}
Every C function called from 4GL must have the FUNCTEST declaration.
5) PROBUILD
PROBUILD must be invoked from Windows. You may create an icon invoking probuild acording to your environment.
Example for V6:
C:\DLC\_PROWIN.EXE C:\DLCLOAD\EUCAPP\EUC -RO -p EUC.P
Example for V7 / V8:
C:\DLC\BIN\_PROWIN.EXE C:\DLC\PROBUILD\EUCAPP\EUC -RO -p EUC.P
The working directory can be the one you are using for this test.
When you start PROBUILD, you may specify your working directory, choose "Progress client" from the PRODUCT LIST, accept the default LINK SCRIPT/EXECUTABLE NAMES and select "HLC applications" from the CONFIGURABLE ELEMENTS. In version 6 you must also select the apropiate C compiler option from the CONFIGURABLE ELEMENTS.
You may need to add more elements from the CONFIGURABLE ELEMENTS list depending on if you need access to remote databases, dataservers or gateways.
Next screen is the OBJECT FILES. Here you must type the HLPRODSP.OBJ and all your object files which contain your C functions, for example MYTEST.OBJ. It is not necessary to have previously compiled these files, since PROBUILD only builds the link script, doing nothing with the OBJ files specified.
Once PROBUILD has created the link script you can exit Windows or open a DOS prompt windows to compile and link the files. No matter if you modify and recompile your source files, the link script will always be the same and will not need to be re-created. You will need to run PROBUILD again only if you add or remove C source files or you want to add or remove configurable elements.
6) COMPILING
You must compile your C source files according the requirements of your C compiler and your PROGRESS/Windows environment. This example is using Microsoft Visual C++ 1.5 compiler:
cl -Os -AL -Gs -Zp -c hlprodsp.c
cl -Os -AL -Gs -Zp -c mytest.c
You may add additional parameters if you need them.
7) LINKING
You must simply invoke the Microsoft linker provided with your Visual C++ package using the link script built with PROBUILD.
Example for V6:
LINK @WRX.LNK
Example for V7/V8:
LINK @_PROWIN.LNK
After linking you get the _PROWIN.EXE executable.
8) TEST !
Start the PROGRESS session from Windows, executing your _PROWIN.EXE from the Program Manager.
In the PROGRESS Editor type the CALL statement to test your function.
For example:
CALL HOLA.
Note that you must use the name assigned in HLPRODSP.C instead of the C function name. Be careful with the case, because the PROGRESS CALL statement is case sensitive.
You should see a dialog box with the text "Hola Emeanos".
9) PROBLEMS ?
If you have not succeeded:
Repeat the steps carefully, if necessary start again from scratch. Be careful with environment variables, compiler parameters and the C source code. For test purposes you may use the examples shown here to ensure that your environment is correct. If you are sure you are doing the correct things, then call PROGRESS Technical Support..