×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Below is a simple example to illustrate my point. Of course, I don't
necessarily advocate this method. I just thought I would provide it as an
example.
We have two very simple programs: CALLER and CALLEE. CALLER calls CALLEE
with a null procptr. CALLEE sets the procptr to the address of its
NON-EXPORTED sub-proc and returns it. CALLER then calls the sub-proc using
the procptr. The call is successful, the expected data is returned, and
everybody is happy.
Things to note are:
1) If the two pgms are in different activation groups and the one containing
CALLEE is relcaimed then the sub-proc addresses may or may not be valid.
2) Setting on *INLR in the main proc within CALLEE 'may' affect things when
calling the sub-proc. Certainly any open files would be closed. However,
module-level data should still be intact as the variables are not
re-initialised after setting on *INLR until the main procedure is called
again. All non-static sub-proc variables (by their nature) are
re-initialised each call. Static sub-proc variables are never re-initialised
- even when calling the main proc after *INLR is set on. The data and
associated addresses will only be invalid when the program unloads (such as
when an activation group is successfully reclaimed). Do not be fooled by the
fact that the internalData field is local to the sub-proc. It works equally
well if the variable is global and *INLR is set on.
3) Everything else I have not mentioned in 1) or 2) above. I'm sure others
will fill in the gaps. :-)
CALLER:
****************************************************************************
******************
d caller pr extpgm('CALLER')
d caller pi
// Procedure interface for calling callee - this will get pointer to
sub-proc...
d callee pr extpgm('CALLEE')
d pointer * procptr
// Procedure interface for sub-proc within callee - will pass some data...
d someProc pr 32a extproc(myPointer)
// Module variables...
d myPointer s * inz procptr
d myData s 32a inz
/free
// Call callee and get pointer to internal sub-proc...
callee(myPointer);
// Call the internal sub-proc...
myData = someProc();
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.