Call a function in a shared library: Difference between revisions

Content added Content deleted
(added Ol)
m (→‎{{header|REXX}}: added whitespace, used a template for the output section.)
Line 1,623: Line 1,623:
The example is using the standard library that is supplied with Regina REXX that contains a wide range of functions.
The example is using the standard library that is supplied with Regina REXX that contains a wide range of functions.
<lang rexx>/*REXX pgm calls a function (systextscreensize) in a shared library (regutil).*/
<lang rexx>/*REXX pgm calls a function (systextscreensize) in a shared library (regutil).*/
z=rxfuncadd('sysloadfuncs', "regutil", 'sysloadfuncs') /*add a function lib.*/
z= rxfuncadd('sysloadfuncs', "regutil", 'sysloadfuncs') /*add a function lib.*/
if z\==0 then do /*test the return cod*/
if z\==0 then do /*test the return cod*/
say 'return code' z "from rxfuncadd" /*tell about bad RC. */
say 'return code' z "from rxfuncadd" /*tell about bad RC. */
Line 1,632: Line 1,632:


/* [↓] call a particular function. */
/* [↓] call a particular function. */
y=systextscreensize() /*Y now contains 2 numbers: rows cols */
y= systextscreensize() /*Y now contains 2 numbers: rows cols */
parse var y rows cols . /*obtain the two numeric words in Y. */
parse var y rows cols . /*obtain the two numeric words in Y. */
say 'rows=' rows /*display the number of (terminal) rows*/
say 'rows=' rows /*display the number of (terminal) rows*/
Line 1,638: Line 1,638:
call SysDropFuncs /*clean up: make functions inaccessible*/
call SysDropFuncs /*clean up: make functions inaccessible*/
/*stick a fork in it, we're all done. */</lang>
/*stick a fork in it, we're all done. */</lang>
'''output''' &nbsp; (which happens to reflect the program's author's particular screen size for the "DOS" window):
{{out|output|text=&nbsp; (which happens to reflect the program's author's particular screen size for the "DOS" window):}}
<pre>
<pre>
rows= 62
rows= 62