Progress
Portability Guide
Accessing C Functions
The Progress Host Language Call (HLC) Interface provides a technique to call C language functions from within Progress applications. You can use Progress HLC to add portable custom features to Progress.
If you intend to port your extensions to other environments, use HLC. If you intend to build extensions for use with Windows only, use dynamic link libraries (DLLs).
A DLL is a module that contains a collection of compiled functions or procedures that Windows applications can access. An application links to these routines at run time rather than at build time, and shares the DLL code with other applications that link to them. Progress lets you link and execute DLL routines from a 4GL procedure. Using these routines, you can write applications that perform a wide range of Windows functions.
DLL entry points work only with Windows (GUI and character). For more information on dynamic link libraries, see the Progress External Program Interfaces manual.
To ensure portability, avoid accessing DLL entry points provided by Windows and third-party developers, or use the preprocessor to isolate this type of code. For more information on the OPSYS preprocessor name, see the "Operating System Statements" section. For more information on isolating your code using the preprocessor, see "User Interface Design," or refer to the Progress Programming Handbook.
If you intend to port your HLC application, make your C functions as portable as possible by following these guidelines:
- Avoid operating-system-specific calls. Proposed UNIX-style portable operating system standards exist, but their acceptance is limited. Progress runs on several operating systems that do not support these standards.
- If you must make operating-system-specific calls, hide them behind a standard application interface of your own design. If possible, confine the interface definition and all operating-system-specific code to a single source module, where you can modify it easily.
- Use the UNIX lint utility if it is available on your system. The lint utility flags C language statements in your code that are potential sources of portability problems. For more information on lint or its equivalent, see your system documentation.
- When you pass a value to a function, cast it to the data type the function expects. For example, the following function call casts the number 23 as a long:
- Do not use C functions when you can use standard Progress 4GL code.
- Do not write your own function if there is an HLC library function that provides the same functionality.
For information on building an HLC executable and a complete listing of all HLC library functions, see the Progress External Program Interfaces manual.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |