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:
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?
Pinned topic Making metal C not use NAB or providing a custom prolog and epilog
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2010-12-16T13:54:16Z at 2010-12-16T13:54:16Z by SystemAdmin
Re: Making metal C not use NAB or providing a custom prolog and epilog2010-11-12T21:08:38ZThis is the accepted answer. This is the accepted answer.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.
Visda 060001SUB132 Posts
Re: Making metal C not use NAB or providing a custom prolog and epilog2010-11-13T11:43:21ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
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.
Re: Making metal C not use NAB or providing a custom prolog and epilog2010-12-16T13:54:16ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
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.