On 4/10/2012 9:57 AM, Phil Smith wrote:
Steve Comstock wrote:
I'm confused here, because the title of the thread
is 'C calling HLASM' and here we are talking about
PL/I.

Yeah, true...topic drift. Renamed.

So what's really going on here that is the mystery?

My guess is: you have a C function that you want to
call from, in this instance, a PL/I program. Right?

Right.

Can you show us the definition of the C function
(not the body, just the definition of parameters
along with any pragma statements you might have,
and compiler options relevant to calls / function
references)?

See below.

Can you show us how you invoke the function from
C, COBOL, and Assembler? That is, some sample calls
or function references that work successfully, both
with two arguments and four arguments (BTW: do you
allow the output buffer to be specified without the
last length argument? How about no output buffer
but with a length? In other words, must the user
specify exactly two or exactly four arguments?)

The previous post had an example from COBOL; C is the same, only in C
syntax.Assembler too. We validate that we got three or five arguments
(note there's an initial, required argument).


Yeah, but I don't have the previous post. I'm trying
to get better about cleaning out my inbasket, and
sometimes I get overzealous.



Finally: there are some differences in the Enterprise
PL/I compiler regarding compile time options and
options available for declaring functions and
subroutines so I ask this: is your expectation that
your customers will be running the Enterprise PL/I
compiler or some earlier compiler?

And the answer is?




Here's a C prototype, with the serial numbers filed off:

int THEFUNCTION( char *magic,
              char *inputBuffer,
              int  *inputLength,
              ...)

Do you really have the ellipsis? If so, my reading
of the docs is that all arguments after int  *inputLength,
will have to be of that type (that is, all pointers to
integer values) and not pointer to char followed by pointer
to int; of course, you can play games. But I think that
would be a problem.

Generally, the above C function will expect, when it is
called, to have R1 set up this way:

(R1) -> a(magic)
        a(inputBuffer)
        a(inputLength)
        a(outputBuffer)
        a(outputLength)


So how, in your C code, do you currently check how
many arguments have been received?

This won't be hard, really, :-) , but we need to pay
attention to detail.

What's weird to me is that PL/I and C share parts of
the same compiler logic! Ah well.


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
    for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to