Topic
No replies
SystemAdmin
SystemAdmin
196 Posts
ACCEPTED ANSWER

Pinned topic Making metal C not use NAB or providing a custom prolog and epilog

‏2010-11-12T00:26:12Z |
I'm trying to use the metal C compiler to write a routine to be called from an existing program which I can not change. It uses standard MVS linkage convention to call compiled routines. It allocates a 36 word save area; it does not support next available byte (NAB) and does not provide storage for the called routine to use as another save area.

As far as I can determine, the only way to get the metal compiler to not use NAB is to provide a custom prolog and epilog. Is there another way to make metal C not use NAB? If so, could someone please tell me how?

Assuming that I have to use a custom prolog and epilog, I'm having trouble. I know I need to do something like this:

#pragma prolog(myroutine,"MYPROLOG")
#pragma epilog(myroutine,"MYEPILOG")

What I don't know is how to provide the code for the MYPROLOG and MYEPILOG macros. Should I use the __asm() statement to define the entire prolog and epilog macros? Or, should I somehow include them from other files?

Can someone explain how to provide a custom prolog and epilog? And maybe even provide a sample?

Thank you.

David Liebtag
Updated on 2010-12-16T13:54:16Z at 2010-12-16T13:54:16Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    196 Posts
    ACCEPTED ANSWER

    Re: Making metal C not use NAB or providing a custom prolog and epilog

    ‏2010-11-12T21:08:38Z  in response to SystemAdmin
    I figured out how to provide a custom prolog and epilog.

    I would still like to know if it is possible to make metal C not use NAB without supplying a custom prolog and epilog.

    Thank you.

    David Liebtag
    • Visda
      Visda
      22 Posts
      ACCEPTED ANSWER

      Re: Making metal C not use NAB or providing a custom prolog and epilog

      ‏2010-11-13T11:43:21Z  in response to SystemAdmin
      Hi David,

      Glad you found the answer!
      As for the next available byte, using the prolog/epilog command line option or #pragma in the source is the way to go to communicate with the Metal C compiler not to use NAB.

      Thanks,
      Visda
  • SystemAdmin
    SystemAdmin
    196 Posts
    ACCEPTED ANSWER

    Re: Making metal C not use NAB or providing a custom prolog and epilog

    ‏2010-11-15T21:37:37Z  in response to SystemAdmin
    Thanks Visda. Now I can stop worrying about NAB and go on to the next thing.

    David Liebtag
    • SystemAdmin
      SystemAdmin
      196 Posts
      ACCEPTED ANSWER

      Re: Making metal C not use NAB or providing a custom prolog and epilog

      ‏2010-12-16T13:54:16Z  in response to SystemAdmin
      My apology for noticing this thread a bit late.
      However we all know it is better late than never.

      There is a way to ask the compiler to generate a prolog/epilog that does not require NAB to get the stack space.

      There is a variation of the #pragma prolog/epilog directive in the following form:

      #pragme prolog/epilog(foo, main)

      Notice main is a keyword and it is not enclosed in double quotes.

      This directive tells the compiler that if you were generating default prolog/epilog code for function "foo", give it the default prolog/epilog code that you would generate for function "main".

      The default prolog code for function "main" uses the STORAGE macro to get the stack space of a maximum size if 1M.

      This directive is new in the z/OS V1R11 XL C compiler.