IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem linking AMODE64 + ICSF = DLL under OMVS


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
HenriqueS

New User


Joined: 17 Feb 2007
Posts: 30
Location: Brazil

PostPosted: Tue Jan 25, 2011 4:47 am
Reply with quote

Hello,

I am having trouble trying to link a C DLL that uses ICSF under OMVS.

This is my command line:

Code:

cc -V -c -o MyDLL.o -Wc,dll,LP64,exportall -I. -I/usr/lpp/java/J6.0_64/include MyDLL.c > cmplisting.txt
#customize DD cards used by the linker
export _CC_L6SYSLIB="CSF.SCSFMOD0:CEE.SCEEBND2:SYS1.CSSLIB:CEE.SCEELIB"
export _CC_L6SYSIX="CEE.SCEELIB(CELQS003)"
cc -V -W l,dll,LP64 -o MyDLL.dll  MyDLL.o /usr/lpp/java/J6.0_64/bin/j9vm/libjvm.x > lnklisting.txt


This is my output:

Code:

 IEW2469E 9907 THE ATTRIBUTES OF A REFERENCE TO CSNFKRC FROM SECTION GenChav#C
          DO NOT MATCH THE ATTRIBUTES OF THE TARGET SYMBOL. REASON  2
 IEW2469E 9907 THE ATTRIBUTES OF A REFERENCE TO CSNFKRC FROM SECTION GenChav#C
          DO NOT MATCH THE ATTRIBUTES OF THE TARGET SYMBOL. REASON  2
FSUM3065 The LINKEDIT step ended with return code 8.


This message, according to the manuals is:
Quote:

Explanation: The interface attributes as indicated by the signatures stored in the ESDs and RLDs do not match. Either the reference was resolved to an incorrect module (which contained a symbol of the same name as the desired module) or there was an error in the source code. The possible values of the reason field are:
...
2. The xplink attributes of the reference and target do not match.
...


We had no messages showing up while compiling it under z/OS, but it seems we ended up not having the DLL we wanted in BOTH CASES (OMVS and z/OS compile/link), because it turned out to be an executable file (save attribute on the linker listing is EXECUTABLE = YES in both cases).

Still, a file got written to disk and I tried to use it anyway, but my main program (the one that uses the dll) crashed...

Any ideas?
Back to top
View user's profile Send private message
HenriqueS

New User


Joined: 17 Feb 2007
Posts: 30
Location: Brazil

PostPosted: Tue Jan 25, 2011 5:29 am
Reply with quote

Well, just to mention, I think the EXECUTABLE attribute is not the problem.

I did pull out the ICSF functions and recompiled the DLL just with pritfs from it. I got no complain from the linker, got EXECUTABLE = YES on the save module summary and it did run perfect.

SAVE SUMMARY for DLL with ICSF call (linker complains and crashes when called from main program):
Code:

1SAVE MODULE ATTRIBUTES:
    AC                  000
    AMODE                64
    COMPRESSION         BINDER DATA
    DC                  NO
    EDITABLE            YES
    EXCEEDS 16MB        NO
    EXECUTABLE          YES
    MIGRATABLE          NO
    OL                  NO
    OVLY                NO
    PACK,PRIME          NO,NO
    PAGE ALIGN          NO
    REFR                NO
    RENT                YES
    REUS                YES
    RMODE               ANY
    SCTR                NO
    SIGN                NO
    SSI
    SYM GENERATED       NO
    TEST                NO
    XPLINK              YES
    MODULE SIZE (HEX)   00000E38
    DASD SIZE (HEX)     0000B000


SAVE SUMMARY for DLL withOUT ICSF call (just printfs - works perfect called from main program):
Code:

    AC                  000
    AMODE                64
    COMPRESSION         BINDER DATA
    DC                  NO
    EDITABLE            YES
    EXCEEDS 16MB        NO
    EXECUTABLE          YES
    MIGRATABLE          NO
    OL                  NO
    OVLY                NO
    PACK,PRIME          NO,NO
    PAGE ALIGN          NO
    REFR                NO
    RENT                YES
    REUS                YES
    RMODE               ANY
    SCTR                NO
    SIGN                NO
    SSI
    SYM GENERATED       NO
    TEST                NO
    XPLINK              YES
    MODULE SIZE (HEX)   00000B80
    DASD SIZE (HEX)     0000B000



Just to remember, the compile and link command lines are the same for both version of the DLL:
Code:

cc -v -V -c -o MyDLL.o -W c,dll,LP64,exportall -I. -I/usr/lpp/java/J6.0_64/include MyDLL.c > cmplisting.txt
export _CC_L6SYSLIB="CSF.SCSFMOD0:CEE.SCEEBND2:SYS1.CSSLIB:CEE.SCEELIB"
export _CC_L6SYSIX="CEE.SCEELIB(CELQS003)"
cc -v -V -W l,dll,LP64,LET=8,COMPAT=ZOSV1R10 -o MyDLL.dll MyDLL.o /usr/lpp/java/J6.0_64/bin/j9vm/libjvm.x > lnklisting.txt
Back to top
View user's profile Send private message
HenriqueS

New User


Joined: 17 Feb 2007
Posts: 30
Location: Brazil

PostPosted: Wed Jan 26, 2011 9:59 pm
Reply with quote

Good news here...

As you may check, documentation clearly states that jsut referring to CSF.SCSFMOD0 on the DD SYSLIB should be enough as seen in http://publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.csfb400/lnkcal.htm .

But following the documentation I was getting this all the time:

Code:

 IEW2469E 9907 THE ATTRIBUTES OF A REFERENCE TO CSNFKRC FROM SECTION GenChav#C
          DO NOT MATCH THE ATTRIBUTES OF THE TARGET SYMBOL. REASON  2
 IEW2469E 9907 THE ATTRIBUTES OF A REFERENCE TO CSNFKRC FROM SECTION GenChav#C
          DO NOT MATCH THE ATTRIBUTES OF THE TARGET SYMBOL. REASON  2
FSUM3065 The LINKEDIT step ended with return code 8.


A load module was saved but was corrupted, with broken references to the ICSF functions I was referring to. Listing the CSF.SCSFMOD0 library I could clearly see the module was there. Also, the reason code showed in the linker error message seemed to say that found a target module for my program call, but it was incompatible:

Quote:

IEW2469E THE ATTRIBUTES OF A REFERENCE TO symbol-name DO NOT MATCH THE ATTRIBUTES OF THE TARGET SYMBOL. REASON reason.

Explanation: The interface attributes as indicated by the signatures stored in the ESDs and RLDs do not match. Either the reference was resolved to an incorrect module (which contained a symbol of the same name as the desired module) or there was an error in the source code. The possible values of the reason field are:

2. The xplink attributes of the reference and target do not match.



So, I had no idea if this was some sort of documentation error from IBM or if the z/OS team here screwed up during the s.o. upgrade. But I kept researching and found several references of AMODE64 compile/linking in the PKCS#11 implementation from IBM (PKCS#11 is an standard library call, it is pretty much a wrapper, so instead of calling the CSNxxxxx ICSF calls, you call them using another naming scheme just for portability purposes, easing cross platform development). Bu in the end it relies on calling the ICSF functions...

There I found about SYS1.SIEALNKE and SYS1.SIEASID(CSFDLL64).

First, SYS1.SIEALNKE, a library with CSF calls compiled in AMODE64 with a CSFDLL64 member, so I did refer to in on my linker job SYSLIB .

Second, SYS1.SIEASID(CSFDLL64), is a "sidedeck" with a mapping scheme of 64 functions available in the target module for linking, this goes on the SYSLIN DD of my linker job...

Just to note that CSF.SCSFMOD0 was ripped off from the SYSLIB.

After that, tried new compile/link and it worked like a charm. Also, my caller AMODE64 app was able to call the ICSF function without issues.

I am leaving this here if anyone struggles with the same problem and if any IBMer is seeing this, it would be nice to investigate more about the issue and maybe update the ICSF Programming Guide manual, because the linkng instructions there do not work for AMODE64...

My z/OS here is 1.11.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts using EGREP in OMVS TSO/ISPF 9
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
Search our Forums:

Back to Top