Progress
External Program
Interfaces


Using the CALL Statement

Use the Progress 4GL CALL statement to execute a C function from a Progress procedure.

The CALL statement has the following syntax:

SYNTAX
CALL routine-identifier [ argument ... ] 

The routine-identifier is the name the PRODSP() dispatch routine maps to an actual C function. The routine identifier is case sensitive; it must have the same letter case as its definition in the dispatch routine.

The argument is one or more arguments that you want to pass to the C function. Arguments passed to the C function must be read only. If you supply multiple arguments, separate them with spaces. If you separate them with other delimiters, such as commas, Progress passes the delimiters as arguments. Progress converts all arguments to C character strings before passing them to a C function; Progress passes them as an array of character pointers. Therefore, your C functions must expect null-terminated character strings and perform data conversions as necessary.

Figure 2–2 demonstrates how to run the CALL statement.

Figure 2–2: Running a CALL Statement

The following CALL statement executes hlcroutine, the routine identifier for your C function:

CALL hlcroutine. 

When you use a CALL statement to invoke a routine that updates a shared buffer, you must make sure that a transaction is active at the time of the call. For more information, see the "Using a Library Function That Writes To a Shared Buffer" section.

The CALL statement transfers control to the HLC dispatch routine, PRODSP(), passing it your routine identifier and any arguments. The example in Figure 2–2 passes the hlcroutine routine identifier with no arguments to PRODSP(), which is located in hlprodsp.c.

You must modify the prototype hlprodsp.c file supplied with Progress HLC to define your routine identifiers and C function names. Based on definitions you have set up in hlprodsp.c, the PRODSP() dispatch routine maps the routine identifier to your C function, and calls it. The example in Figure 2–2 maps hlcroutine to the function hlcfunc().

If the PRODSP() dispatch routine does not define the routine identifier or defines it with a different letter case, an error results.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095