C/C++

C/C++

C/C++

Your one-stop destination to learn and collaborate about the latest innovations in IBM C/C++ for z/OS compilers to develop high-performing C/C++ applications and system programs on z/OS while maximizing hardware use and improving application performance.

 View Only
  • 1.  calling a function using a structure for the parameters rather and in the parmlist

    Posted Sun January 28, 2024 10:54 AM

    I am used to using a function like

    IRRSFA64( workarea, // WORKAREA
    &ALET1 , // ALET
    &SAF_RC, // SAF RC
    &ALET2, // ALET ....

    RACF provides a structure ..
     struct comy {                      /* Common SAF plist                       */ 
       ptr64_t comy_worka_stor_a;       /* Addr of 1024 byte work area            */ 
       ptr64_t comy_safrc_alet_a;       /* Addr of ALET for SAF return code       */ 
       ptr64_t comy_safrc_stor_a;       /* Addr of SAF return code                */ 
       ptr64_t comy_racrc_alet_a;       /* Addr of ALET for RACF return code      */ 
       ptr64_t comy_racrc_stor_a;       /* Addr of RACF return code               */ 
       ptr64_t comy_racsc_alet_a;       /* Addr of ALET for RACF reason code      */ 
    ....

    of the same parameters. I have not been able to use this structure in the IRRS....() functions. Is it possible? The problem is the code get passed the address of the parms, instead of the parms - and so does not work.
    I would like to initialise the structure then use it. I'm happy to use the "old" way if this not possible,

    Colin



    ------------------------------
    Colin Paice
    ------------------------------


  • 2.  RE: calling a function using a structure for the parameters rather and in the parmlist

    Posted Thu March 14, 2024 05:47 PM

    When you define the prototype of the function, tell it you are passing a struct, not a pointer to a struct.    For example, in this IPCS verb exit I wrote, this is what main() looks like:  

    int main(struct abdpl adpl) {   // R1 on entry points to the structure, not to a pointer to the struct.   
    ,,,



    ------------------------------
    Todd Burch
    ------------------------------



  • 3.  RE: calling a function using a structure for the parameters rather and in the parmlist

    Posted Fri March 15, 2024 04:13 AM
    Hi Todd,

    Thanks for your comments.

    Can you explain why RACF provides the structure, if it cannot be used!?

    My only thoughts were that it was created by a non C developer

    Colin





  • 4.  RE: calling a function using a structure for the parameters rather and in the parmlist

    Posted Fri March 15, 2024 05:24 PM

    I'll try a test case this next week and let you know.  



    ------------------------------
    Todd Burch
    ------------------------------