Hi Chuck,

Its a compile-and-link in one go:

   cc bla.c  bla1.s

The result is the a.out executable.

So I should add a linker-option to make it non-reentrant...?

Thanks,
Etienne

On Wed, 1 May 2013 10:41:36 -0500, Chuck Arney <[email protected]> wrote:

>How is the program linked?  The S0C4 would occur if you linked the program as 
>reentrant since you are modifying the program storage.
>
>Chuck Arney
>Arney Computer Systems
>
>-----Original Message-----
>From: IBM Mainframe Discussion List [mailto:[email protected]] On 
>Behalf Of Etienne Thijsse
>Sent: Wednesday, May 01, 2013 10:28 AM
>To: [email protected]
>Subject: Mixing C and assembler - under OpenMVS
>
>Hi all,
>
>I am trying to call an assembler function from C:
>
>C-code (bla.c):
>
>#pragma linkage(BLA,OS)
>main()
>{
>    BLA();
>    printf("No crash.\n");
>}
>
>Assembler code (bla1.s):
>
>BLA     CSECT
>BLA     MODE  ANY
>
>           SAVE   (14,12)
>           BALR    3,0
>           USING  *,3
>           ST        13,SAVE+4      <<<<< crashes here
>
>*         todo: add useful code here
>
>           L           15,=X'01'
>           L           13,SAVE+4
>           RETURN (14,12),RC=(15)
>
>SAVE   DS       18F
>           END
>
>So the only code in this assembler source is the "standard linkage" stuff, 
>which I got from the "MVS Assembler Language"  book.
>
>I compiled and linked this under OpenMVS like this:
>
>  cc bla.c bla1.s
>
>which gives me an executable 'a.out' in the HFS.
>
>Running this under OpenMVS  crashes in the "ST        13,SAVE+4"  line, SC04. 
>If I comment out that line and the corresponding L13,SAVE+4 line, it does not 
>crash anymore.
>I don't understand this... This ST line is part of the standard linkage 
>'protocol'; the area where the ST stores is declared in the SAVE DS 18F line 
>at the bottom --- Why does this crash?
>
>What is weirder still is that I can copy a.out to a PDSE member, and submit it 
>with some JCL that has CEE.SCEELIB in its STEPLIB; this does not crash, 
>without SCEELIB it also crashes.
>Adding CEE.SCEELIB to the STEPLIB environment variable in OpenMVS however does 
>not help, it keeps crashing, SC04.
>
>Anyone have an idea?
>
>Thanks,
>Etienne
>
>----------------------------------------------------------------------
>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

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

Reply via email to