That looks good to me. Make sure that you setup the parameter lists correctly. C/C++ are call by value languages. The code path for calling a routine is just a few instructions. It loads LE control blocks into registers and then uses BSM to invoke the routine.

You certainly will need LE if your calling C/C++ code other than Metal/C.

You only need XPLINK if your C/C++ programs are compiled XPLINK. I always use XPLINK because it almost always generates faster code but the subroutine linkage is very different to OS linkage and you have to take that into consideration when debugging.

On 20/08/2014 4:28 AM, Donald Likens wrote:
I have been looking at the LE documentation now for days and still not sure 
what I need to do to have my Assembler program call C or C++ programs. I need 
this interface to be very efficient because I will be calling these subroutines 
maybe more than a 1,000,000 times a day. What I have come up with is to use 
CEEPIPI to build the environment.

          LA    R5,PPTBL           GET ADDRESS OF PIPI TABLE
          ST    R5,@CEXPTBL        CEEXPTBL-ADDR -> PIPI TABLE
          L     R15,PPRTNPTR       GET ADDRESS OF CEEPIPI ROUTINE
*                                 INVOKE CEEPIPI ROUTINE
          CALL  (15),(INITSUB,@CEXPTBL,@SRVRTNS,RUNTMOPT,TOKEN)

I will have three subroutines so I think I need to put each one of these 
routines in the preinit table.

Now I think I need to use CEEPIPI again when I want to call each subroutine.

          ST    R11,PARM
          L     R15,PPRTNPTR       GET ADDRESS OF CEEPIPI ROUTINE
          CALL  (15),(CALLSUB,PTBINDEX,TOKEN,PARM,                      X
                SUBRETC,SUBRSNC,SUBFBC)   INVOKE CEEPIPI ROUTINE

Note:
Note: The C routines have not been created yet, so I can't try these things out.

Questions:
1) Do I have it correct?
2) Do I even need LE?
3) The book talks about XPLINK. I don't quite understand it. Is this something 
I should explore more?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to