Can PL/I interface to C? 
Author Message
 Can PL/I interface to C?

Does IBM support mixed language programming in its Windows compilers?
How would IBM PL/I for Windows (either personal or VA) interface to an existing MS-VC program that makes
following
subroutine call?

 sum2(a,b,&c);        where a,b,c are real arguments  and sum2 returns a+b in c

Below is my compatible subroutine written in CVF fortran.

SUBROUTINE sum2 [C,ALIAS:"_sum2"] (a,b,c)
REAL :: a,b,c[REFERENCE]
c = a+b
END SUBROUTINE

Actions taken by CVF compiler
=====================
1. object output name changed to that produced by VC  _sub1
2. reverse stack arg sequence assumptions
3. assume args are passed by value
4. explicitly override 3rd arg with a [reference]
 5. suppress normal stack arg cleanup on exit, since VC is cleaning up
=====================



Sat, 25 Jun 2005 18:05:02 GMT  
 Can PL/I interface to C?


Quote:
> Does IBM support mixed language programming in its Windows
compilers?
> How would IBM PL/I for Windows (either personal or VA) interface

to an existing MS-VC
Quote:
> program that makes following subroutine call?

>  sum2(a,b,&c);        where a,b,c are real arguments  and sum2

returns a+b in c

I don't believe that standard PL/I supports pass by value.  It is
probably an extension
in environments where it is useful.   PL/I does support enclosing
an argument in
()'s, making it an expression so that a temporary copy is passed.

A favorite old trick when it is desired to pass an array by
reference, instead of
by descriptor as usual, is to pass the first element.  Of course
this is non-standard,
but if you know your compiler, it works.

-- glen



Sun, 26 Jun 2005 17:24:44 GMT  
 Can PL/I interface to C?
PL/I has a full boat of options for arguments.  They can be specified as
BYVALUE (C-compatible) or BYADDRESS (I believe that's the keyword).
Quote:



> > Does IBM support mixed language programming in its Windows
> compilers?
> > How would IBM PL/I for Windows (either personal or VA) interface
> to an existing MS-VC
> > program that makes following subroutine call?

> >  sum2(a,b,&c);        where a,b,c are real arguments  and sum2
> returns a+b in c

> I don't believe that standard PL/I supports pass by value.  It is
> probably an extension
> in environments where it is useful.   PL/I does support enclosing
> an argument in
> ()'s, making it an expression so that a temporary copy is passed.

> A favorite old trick when it is desired to pass an array by
> reference, instead of
> by descriptor as usual, is to pass the first element.  Of course
> this is non-standard,
> but if you know your compiler, it works.

> -- glen



Mon, 27 Jun 2005 08:01:18 GMT  
 Can PL/I interface to C?


Quote:
> PL/I has a full boat of options for arguments.  They can be
specified as
> BYVALUE (C-compatible) or BYADDRESS (I believe that's the

keyword).

This is part of standard PL/I, or an implementation extension?

-- glen



Mon, 27 Jun 2005 14:40:00 GMT  
 Can PL/I interface to C?

Quote:

> PL/I has a full boat of options for arguments.  They can be specified as
> BYVALUE (C-compatible) or BYADDRESS (I believe that's the keyword).

Sooo, Peter you being a PL/I guru,  your address of only 2 issues (setting value,reference attributes for
a,b,c arguments)
of the  6  enumerated means to me that the answer is NO,  IBM PL/I for Windows cant interface to code
generated
by a standard Windows C compiler,  right?


Mon, 27 Jun 2005 15:47:34 GMT  
 Can PL/I interface to C?
Not in the standard yet.  It's an IBM VA and Enterprose PL/I extension.
Quote:



> > PL/I has a full boat of options for arguments.  They can be
> specified as
> > BYVALUE (C-compatible) or BYADDRESS (I believe that's the
> keyword).

> This is part of standard PL/I, or an implementation extension?

> -- glen



Tue, 28 Jun 2005 06:18:58 GMT  
 Can PL/I interface to C?
BYVALUE was introduced with PL/I for MVS and VM, and is in all later IBM
compilers.

Quote:



> > PL/I has a full boat of options for arguments.  They can be
> specified as
> > BYVALUE (C-compatible) or BYADDRESS (I believe that's the
> keyword).

> This is part of standard PL/I, or an implementation extension?

> -- glen



Tue, 28 Jun 2005 16:27:40 GMT  
 Can PL/I interface to C?

Quote:

> BYVALUE was introduced with PL/I for MVS and VM, and is in all later IBM
> compilers.




> > > PL/I has a full boat of options for arguments.  They can be
>  specified as
> > > BYVALUE (C-compatible) or BYADDRESS (I believe that's the
> > keyword).

> > This is part of standard PL/I, or an implementation extension?

> > -- glen

VMS PL/I has had this capability since 1981, but somewhat different
syntax:

declare malloc entry(fixed bin(31) VALUE) returns(ptr VALUE);



Fri, 01 Jul 2005 02:41:12 GMT  
 Can PL/I interface to C?



Quote:
> > BYVALUE was introduced with PL/I for MVS and VM, and is in all
later IBM
> > compilers.




> > > > PL/I has a full boat of options for arguments.  They can be
> >  specified as
> > > > BYVALUE (C-compatible) or BYADDRESS (I believe that's the
> > > keyword).

> > > This is part of standard PL/I, or an implementation
extension?

> > > -- glen

> VMS PL/I has had this capability since 1981, but somewhat
different
> syntax:

> declare malloc entry(fixed bin(31) VALUE) returns(ptr VALUE);

I thought VAX/VMS had the %val(), %ref(), and %descr() syntax?

I thought it was supposed to be language independent, though it
conflicts a little with the PL/I preprocessor syntax.

When I was an undergrad, about 1979, I thought about writing a PL/I
compiler for VAX. (DEC hadn't done it yet, or at least the VAX I
knew didn't have it.)  Of course I never found the time to do it.
VAX did make some of the decimal operations and conversions easier
than other machines did, though.

-- glen



Fri, 01 Jul 2005 05:30:46 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Data Interface with CS/3

2. to CS: or not to CS: in F-PC assembler

3. COBOL Migration - interfacing with PL/I V.1.5.1

4. PRAGMA Interface(PL/I)

5. User Interface Builder -- Pl. Ignore prev post

6. CA Cans VO ?

7. It's not bad canned meat...

8. It's not bad canned meat...

9. It's not bad canned meat...

10. Using CGI module with 'canned queries'

11. It's not bad canned meat...

12. Logo Komeniusz PL (Logo Comenius PL)

 

 
Powered by phpBB® Forum Software