Functions in persistent libraries.

Chris Kelleher

Administrator
Staff member
Christian-

Hi there, sure this is possible. I have procedures for my function libraries set up similar to the following:

utils.i
<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
/* utils.i */
/* prevent multiple inclusion: */
&IF DEFINED(UTILS_I)=0 &THEN
&GLOBAL-DEFINE UTILS_I

DEFINE NEW GLOBAL SHARED VARIABLE hpUtils AS HANDLE NO-UNDO.
&IF DEFINED(DONTRUN-UTILS)=0 &THEN
IF NOT VALID-HANDLE(hpUtils) THEN RUN utils.p PERSISTENT SET hpUtils.
&ELSE
hpUtils = this-procedure:handle.
&ENDIF

/* --- the forward declarations : --- */

FUNCTION ReturnString
RETURNS CHARACTER
()
IN hpUtils.

&ENDIF /* &IF DEFINED(UTILS_I)=0 */
[/code]

utils.p
<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
/* utils.p */
&GLOB DONTRUN-UTILS
{utils.i}

FUNCTION ReturnString RETURNS CHARACTER () :
RETURN "".
END FUNCTION.
[/code]

Then to use any of the functions in utils.p, you simply need the following code:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
{utils.i}
DISPLAY ReturnString().
[/code]

Hope this helps.

-Chris

------------------
Chris Schreiber
ProgressTalk.com Manager
chris@fast4gl.com
 

Christian Bryan

New Member
Is it possible to include user defined functions in persistent libraries? If it is possible, then how could a function call another function within the same persistent library?

Cheers

Christian

------------------
 
Top