I think you are safer that way. We have code that does the __cinit() call for our Metal C routines that is in a separate routine that never gets compiled with "normal" C. I see no reason why you could not put it into your function and use #ifdefs to not compile it when you are using "standard" C. And our define for the Metal C compiles and #ifdefs is METAL_C so it is obvious which code is specific to that compile.
Two warnings: since you are going to different platforms with your product, make sure you do a static compile and bind with the Metal C. We ran into issues compiling on z/OS 1.12 and trying to run on 1.11. Once we did things static we were fine on both platforms. Also, if you are going to use 64-bit, there is a documentation issue in the __cinit() sample code. You do NOT need to cast the return from the __cinit() call for 64-bit or 32-bit. You will get compile errors if you try it use the sample code as it. Lloyd ----- Original Message ---- From: Charles Mills <charl...@mcn.org> To: IBM-MAIN@LISTSERV.UA.EDU Sent: Mon, April 1, 2013 10:03:56 AM Subject: Re: Linking to MVS standard linkage function from Rexx Great minds think alike! I am now thinking that perhaps I write the "SMF build" logic in the Metal C subset dialect, but then compile it two ways: 1. With Metal C for linking with Rexx. 2. With "standard" C (is there a name for non-metallic C? Plastic C?) for linking with the C++ code. Along with the advantage of avoiding the sorts of problems you allude to, another advantage would be that I could "sneak" some printf's for debugging purposes into the standard C compile, and then after debugging comment them back out of the source before doing the Metal C compile. (Or use #ifdefs.) Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Lloyd Fuller Sent: Monday, April 01, 2013 4:03 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Linking to MVS standard linkage function from Rexx If he is careful, he can even compile C1 for normal C calls and compile it a second time with Metal C for calling from Rexx. I agree with Charles, calling from Rexx to Metal C is probably simpler than calling a standard C routine. We have several routines that we compile both ways: for some things we have a C or C++ main and use a set of functions compiled with c89. For other uses of those same functions, we have a little C routine DESIGNED to be called from assembler that initializes the Metal C library and builds the parameter lists for the same set of C functions. For a few of the "normal" C functions, we have some two-way #ifs in the code that says that if this is Metal C you use this set of #includes and it not Metal C you use a different set. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN