Hi Eric,

 If you use a typedef, and then declare the typedef with the pragma linkage,
 it -should- do it for you.

 We do that all the time with the Dignus compilers.

 For example, to invoke the and OS-style linkage that passed 
 an integer (by-reference) and return a value with a pointer, you
 might do this:


   typedef void os_func_type(int val, int *retval_ptr);
#pragma linkage(os_func_type, OS)
   os_func_type *os_func_ptr;

 
 Then assign to address to the function pointer (in your case
 it would be the result of the LOAD) and just make your function
 calls through the pointer.

     os_func_ptr = entry-point-from-load

 The compiler we generate code that passes the address of
 copy for the first parameter (since C is pass-by-value, a copy
 of the integer is made, as i was declared by-value), and then
 address of an int for the return value.  The compiler will also
 set the VL-bit on the last parm; then load the pointer into R15
 and BALR-away.

     os_func_ptr(val, &retval);

 I'm pretty sure that would work for the IBM XLC compiler too.

     - Dave Rivers -

==
Get your mainframe programming tools at http://www.dignus.com

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

Reply via email to