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...
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:
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...