[comp.sys.isis] isis and C++

rembold@rainbow.ecn.purdue.edu (Bernhard F Rembold) (02/01/91)

I am trying to use ISIS with C++ and have gotten somewhat confused with
the use of basic functions such as 'isis_entry', 'isis_task' etc. Going
through the declarations in the 'isis.h' file has given me some insight
but has not helped me set up a working client-server model.
I would be grateful if someone could post or e-mail me a set of simple
example programs (i.e. client & server) in C++ similar to the timeclock 
example described in the ISIS reference manual.

Thanks in advance, 
  Bernhard 

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Bernhard Rembold                                      rembold@gn.ecn.purdue.edu 
School of Industrial Engineering                              Purdue University
West Lafayette Indiana, 47907, U S A             Telephone (USA) (317) 494-0439
    Who needs documentation if one can spend hours figuring it out alone ?
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

rcbc@cs.cornell.edu (Robert Cooper) (02/02/91)

In article <1991Feb1.151157.17332@noose.ecn.purdue.edu>, rembold@rainbow (Bernhard F Rembold) writes:
>
>I am trying to use ISIS with C++ and have gotten somewhat confused with
>the use of basic functions such as 'isis_entry', 'isis_task' etc. Going
>through the declarations in the 'isis.h' file has given me some insight
>but has not helped me set up a working client-server model.
>I would be grateful if someone could post or e-mail me a set of simple
>example programs (i.e. client & server) in C++ similar to the timeclock 
>example described in the ISIS reference manual.
>
>Thanks in advance, 
>  Bernhard 
>

The main hassle using Isis from C++ is the issue of callback functions.
It is difficult to pass a C++ member-function as a callback to many 
Isis routines that want callbacks, such as isis_entry, t_fork,
pg_monitor etc., because its difficult to pass in the object to
which the member-function belongs as the "hidden" argument
to the member-function. 

The general way to get around this problem is to write regular C
wrapper functions that call the appropriate C++ member functions.
This loses some of the generality of C++, but it works. 

If I get time I'll post an example tiny program to illustrate this,
or one of the C++ Isis users out there might want to give an example.

"Eventually" we will do a better C++ interface on top of the C Isis
interface.

                          -- Robert Cooper

dwf@acl.lanl.gov (Dave Forslund) (02/03/91)

In article <51494@cornell.UUCP> rcbc@cs.cornell.edu (Robert Cooper) writes:


   The main hassle using Isis from C++ is the issue of callback functions.
   It is difficult to pass a C++ member-function as a callback to many 
   Isis routines that want callbacks, such as isis_entry, t_fork,
   pg_monitor etc., because its difficult to pass in the object to
   which the member-function belongs as the "hidden" argument
   to the member-function. 

   The general way to get around this problem is to write regular C
   wrapper functions that call the appropriate C++ member functions.
   This loses some of the generality of C++, but it works. 

   If I get time I'll post an example tiny program to illustrate this,
   or one of the C++ Isis users out there might want to give an example.

   "Eventually" we will do a better C++ interface on top of the C Isis
   interface.

			     -- Robert Cooper

One can do a little better than a pure C wrapper.  If you use a static
method and pass the "this" pointer to it as one of the arguments to
invoke the appropriate object's method, you can use C++.  You just
need to pass the "this" pointer back to the calling process to
"register" it.  If you have only one instance of an object per process
(as possibly implied by the pure C wrapper), you won't even need to
worry about the this pointer.


--
David Forslund
Advanced Computing Laboratory
MS B287
Los Alamos National Laboratory
Los Alamos, NM 87545

Voice:(505) 665-1907
FAX: (505) 665-4939
EMAIL: dwf@lanl.gov