C/C++

C/C++

C/C++

Your one-stop destination to learn and collaborate about the latest innovations in IBM C/C++ for z/OS compilers to develop high-performing C/C++ applications and system programs on z/OS while maximizing hardware use and improving application performance.

 View Only
Expand all | Collapse all

z/OS 2.1 Metal C LP64 runtime library

  • 1.  z/OS 2.1 Metal C LP64 runtime library

    Posted Fri January 09, 2015 04:43 PM

    Hi,

    Trying to use the Metal C runtime library under z/OS 2.1.

    I initialize the Metal C environment for amode 64 using the replacable heap option:

    Every invocation of a library function generates this error: "Expecting pointer to struct or union".

    From the listing I see this when I try to malloc 64 bytes:

      578   170 |    tempstg = (char *)malloc(64);                                                                 |    578   578   170 +    tempstg = (char *)((___MALLOC * ) ( (*(struct __cvt_s * __ptr32 * __ptr32)16) -> __cvtecvt ->\+    578===========> ..................................................................................a...............*=ERROR===========> a - CCN3122 Expecting pointer to struct or union.

    I have the required define before the include of any Metal C headers:

    #define __METAL_CSYSENV_VERSION 2

    I then include both <metal.h> and <stdlib.h>.

    That's all that the compiler and included headers should need to build the malloc call sequence correctly. Right?

    Is this a bug, or am I doing something wrong?

    Frank

     

    Frank_O_Myers@IBM


  • 2.  Re: z/OS 2.1 Metal C LP64 runtime library

    Posted Fri January 30, 2015 05:28 PM

    The problem was in /usr/include/metal/metal.h.

    On or around line 54 of this file, you will find the statement "#ifdef __EXTENDED__". This is incorrect, and should be changed to "#ifdef __PTR32". Failure to do so can cause generation of incorrect code when calling Metal C library functions.

    Frank_O_Myers@IBM