On 27.01.2022 03:24, Glenn Knickerbocker wrote:
> I want to run rexxtry with rxmath loaded so I can use its functions.
> That's straightforward enough:
>
>   Call rexxtry
>   ::Requires 'RxMath' Library
>
> Now suppose I want to load the rxmath functions with shorter names, so I
> don't have to type RXCALC in front of everything:
>
>   ::Routine Log External 'Library RxMath RxCalcLog'
>
> Those renamed routines are only available to my program, not to rexxtry.
>
> I can use PUBLIC to make them available to programs that call my program
> with ::REQUIRES, like so:
>
>   /* mymath.rex */
>   ::Routine Log Public External 'Library RxMath RxCalcLog'
>
>   /* trymath.rex */
>   Trace ?R
>   Say 'Enter commands here:'
>   ::Requires 'MyMath'
>
> But they're not available to a program called *by* my program, whether
> they're loaded by my program or by one it requires.  If I try this:
>
>   Call rexxtry
>   ::Requires 'MyMath'
>   ::Routine TryLog Public External 'Library RxMath RxCalcLog'
>
> neither LOG nor TRYLOG is available to rexxtry.  Am I overlooking some
> way to make them available, short of writing a stub routine to call
> RxCalcLog and putting it on disk (either separately or in a library)?

Not sure whether I understand you correctly. However one observation w.r.t. 
rexxtry.rex: this
utility allows one to run dynamically Rexx statements by interpreting them. 
Directives OTOH are not
statements that can be executed dynamically in this syntax, they are static 
directives to the Rexx
interpreter which processes them only once, when it the interpreter loads and 
checks an ooRexx program.

You could try "call 'MyMath'" instead, which will cause the interpreter to run 
the external Rexx
program and upon return will allow you access to all public routines and public 
classes defined in
'MyMath' (and all public routines and public classes 'MyMath' may bring in via 
::requires directives
of its own etc.).

If you wanted to define a routine dynamically in rexxtry.rex this would be 
possible as well. You
would need to use the .Routine class for this, cf. rexxref.pdf, "5.1.6 Routine 
Class" which also
documents how to load routines from native libraries (cf. 
"loadExternalRoutine").

HTH

---rony




_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to