2

I have been working with some interaction between Progress 4GL programs and C functions invoked from a Shared Library.

I need to write a new function and add it to the SL, so my question is:

Can Progress receive values returned from the SL C functions?

Something like :

Progress_data_type var = SLInvoked_function(...);

If this is possible, Can someone point me to the correct syntax or reference manual?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
EMBT
  • 21
  • 2
  • You might want to change the "progress" tag to "progress-4gl". Otherwise it will get lost in the noise related to progress bars and such. – Tom Bascom Mar 31 '11 at 11:14

1 Answers1

3

The following code shows an example of calling putenv(). The key to returning a value is the "define return parameter" line.

define variable x as integer no-undo.

procedure putenv external "/lib64/libc.so.6":
  define input  parameter env as character.
  define return parameter x   as long.
end.

display os-getenv( "XYZZY" ).
pause.

run putenv( "XYZZY=pflugh", output x ).
display os-getenv( "XYZZY" ).

os-command value( 'echo "$XYZZY"' ).

return.

For more detailed information take a look at UNIX Shared Libraries

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33