Kbase 16726: Which to use? HLC or DLL or INPUT THROUGH ( trap signals )
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
Which to use? HLC or DLL or INPUT THROUGH ( trap signals )
What is HLC?
-----------
HLC allows users to call C functions from
the 4gl using the CALL statement. In order
to use the CALL statement to call a C function,
however, you first need to build a Progress
executable that includes all Progress code linked
with your C functions. Please see the
Host Language Call Interface Chapter in the
External Program Interfaces guide for more detail
on how to build HLC applications.
Why call C functions from the 4GL?
----------------------------------
You may want to perform some low-level functionality
that is not easy to do directly with a 4GL. For instance, you
may want to interface directly with a device or support
trigonometric or other special numeric functions or directly
access third-party proprietary data files such as spreadsheets.
What other options are available?
---------------------------------
On MS-Windows platform you can use Dynamic Link Libraries (DLLs) to
call routines from the 4GL. An application links to these routines at
runtime rather than at build time and shares DLL code with other
applications. Any enhancement to a DLL immediately becomes
available to your application. For more info on using DLLs,
see Chapter 4 of the External Program Interfaces guide.
On Unix and NT platforms you can use INPUT THROUGH or INPUT-OUTPUT
THROUGH. These features are documented in the Programming
Language Reference guide.
HLC vs. DLL or INPUT THROUGH
----------------------------
The following guidelines may help you make the decision on which
approach to take for building extensions to your Progress
application. Please read through all the notes before selecting
a particular approach.
- If you intend to port your extensions to other environments,
then HLC would be the better choice. If you intend to build
extensions ONLY for MS-WINDOWS, then use dynamic link libraries.
DLLs can be used for MS-Windows ONLY.
- It is important to know that Progress (UNIX) relies on signals
from the operating system for its client to server communication.
If you need to trap signals in your application extensions,
then HLC is not the recommended approach as it could interfere
with the integrity of your database and you could experience
unexpected behavior in your application. Instead of using HLC,
which bundles the C routine into the same process space as your
4GL code, it is better to use an approach where your extensions
are part of a separate process and therefore have its own signals
and signal handlers.
In the case where you need to trap signals, the
INPUT THROUGH or INPUT-OUTPUT THROUGH approach is recommended.
You can start your C application off as a separate process and
communicate with it. NOTE: INPUT-OUTPUT THROUGH is available on NT and
UNIX only.
NOTE: The DLL approach will not work in the case where you need
separate process space because when Progress loads a DLL, that DLL
becomes part of the same process.
Can I still use HLC and trap signals?
-------------------------------------
It is strongly recommended that you do not use HLC in an
application that requires trapping and handling of your
own signals in the C code. It is possible for an experienced
C programmer to find out what signal handlers are being used
and to replace them at the beginning of each C routine with
your own signal handler. The programmer would then have to
be sure to replace the original signal handlers before leaving
the C routine IN ANY WAY. This is very tricky and hard to do.
It is not recommended and would be the full responsibility of
the programmer. This type of programming in the context of
HLC is not supported by Progress.
Progress Software Technical Support Note # 16726