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

Does the bind jcl have to include both caller and called programs which are coimpiled with the option METAL?

  • 1.  Does the bind jcl have to include both caller and called programs which are coimpiled with the option METAL?

    Posted Wed July 22, 2015 03:11 AM

    Hi All,

    I have a problem when trying to compile jni code with option METAL. May be because there isn't a jni.h under the directory /usr/include/metal?

    My initial plan is :

    A simple caller named DFSJVM00: 

        - compile in 31-bit mode with option METAL

        - has only 2 lines :

              int DFSJVM64(int) __attribute__((amode64));

              int jvm00 (int func) {

                  return(DFSJVM64(func));

              }

    Compile C and Assembler source is OK. I use the following sample bind job to bind the caller:

    //BIND   EXEC PGM=IEWL,    //            PARM='AMODE=31,MAP,CASE=MIXED'    //SYSLMOD  DD  DSNAME=HLQ.LOAD(MYCODE),DISP=SHR 1    //SYSPRINT DD  SYSOUT=*    //OBJECT   DD  DSN=HLQ.OBJ,DISP=SHR    //SYSLIN   DD *     INCLUDE OBJECT(DFSJVM00)     ENTRY DFSJVM00                                   2    /*

    I got the error: IEW2456E 9207 SYMBOL DFSJVM64 UNRESOLVED. So I write the called program named DFSJVM64 and compiled it in 64-bit mode

    and with option METAL. This is a jni code and I guess because there isn't a jni.h under the directory /usr/include/metal so the compilation failed.

    Then I change the plan: the jni code will be compiled and linked without the option METAL and both are done successfully (named DFSJVM6L). The called program DFSJVM64 will dllload the DFSJVM6L and call dllqueryfn("DFSJVM6L"). And again, the dll.h isn't under the directory /usr/include/metal, so the compile is failed. 

    Another plan: the called program just calls the function DFSJVM6L directly. Compile is OK. But when I run the bind job for the

    caller, if I don't include the jni code, I mean if I have SYSLIN as:

    //SYSLIN   DD *     INCLUDE OBJECT(DFSJVM00)     INCLUDE OBJECT (DFSJVM64)     ENTRY DFSJVM00                                   2    /*

    I got the error:IEW2456E 9207 SYMBOL DFSJVM6L UNRESOLVED. But if I include the DFSJVM6L in then I get different error

    due to the bind job is in 31-bit mode but the jni code in 64-bit mode.

     

    Does anyone have any solution?

     

    Thank you very much for reading a long story.

    Bach Doan

        

     

     

     

    BachDoanIMS


  • 2.  Re: Does the bind jcl have to include both caller and called programs which are coimpiled with the option METAL?

    Posted Wed July 22, 2015 02:04 PM

    Hello,

    Objects for both  source files, generated with Metal C option, should be included in the bind step, in order for it to find and resolve all symbols, I enclosed the JCL.

     

     //BIND   EXEC PGM=IEWL,                                     
     //   PARM='CASE=MIXED'                                      
     //SYSPRINT DD  SYSOUT=*                                     
     //SYSLMOD  DD  DSNAME=VISDAV.LOAD(CODEOUT),DISP=SHR         
     //OBJECT   DD  DSNAME=VISDAV.CAFE.OBJ,DISP=SHR              
     //SYSLIN   DD *                                             
          INCLUDE OBJECT(CODEI)                                  
          INCLUDE OBJECT(CODEJ)                                  
          ENTRY JNI                                              
     /*                                                         

     

    The first JCL, in the original message, fails because the object that includes definition for DFSJVM64 is node included in the bind step.  This object must use Metal C and LP64 options.  You would not find jni.h under /usr/include/metal because this is not a system header file.  Compiler option -I $path should indicate to the compiler where to look for application specific header files.

    And you cannot call the function DFSJVM6L directly in your bind step if it is not compiled with MetalC because as you note the mixing of 64-bit and 31-bit object is only supported if you use Metal C.

     

     

    Visda