InterCallExample

From Pickwiki
Jump to navigationJump to search

HomePage>>SourceCode>>ExternalSource>>C Programs>>InterCallExample

InterCall is a C API for UniVerse/UniData.

Administrative Supplement for Client API's: http://www-3.ibm.com/software/data/u2/pubs/library/100univ/8762.pdf

InterCall Developer's Guide: http://www-3.ibm.com/software/data/u2/pubs/library/100univ/8764.pdf

On page 12 of the InterCall Developer's Guide are instructions for compiling the sample program, ictest.

On Redhat Linux 8.0, with UniData 6.0 PE installed, I followed the instructions:

[root@crisium icsdk]# make -f ictest.mak
cc ictest.o -L/usr/ud60/lib -luvic -lsocket -lnsl -lm -lc -o ictest
/usr/bin/ld: cannot find -lsocket
collect2: ld returned 1 exit status
make: *** [ictest] Error 1
[root@crisium icsdk]#

Note: You must have the environment variable UDTLIB set, (mine is /usr/ud60/lib)

$ UDTLIB=/usr/ud60/lib
$ exort UDTLIB

The message "cannot find -lsocket" means that the compiler cannot find the file libsocket.a, which does not appear to be included with Redhat 8. You can get it here: http://www.phekda.freeserve.co.uk/richdawe/lsck/lsck_dl.htm or here: http://www.isaac.cs.berkeley.edu/palmdevel/ (Thanks to Jef Lee for the second link).

Once libsocket.a is installed (copied to /usr/lib in my case) I tried again:

[root@crisium icsdk]# make -f ictest.mak
cc ictest.o -L/usr/ud60/lib -luvic -lsocket -lnsl -lm -lc -o ictest
ictest.o: In function `getstr':
ictest.o(.text+0x31): the `gets' function is dangerous and should not be used.
/usr/ud60/lib/libuvic.a(rpc.o): In function `uvrpc_readn':
rpc.o(.text+0x289d): undefined reference to `SSL_pending'
rpc.o(.text+0x28b8): undefined reference to `SSL_read'
rpc.o(.text+0x28c3): undefined reference to `SSL_get_error'
/usr/ud60/lib/libuvic.a(rpc.o): In function `uvrpc_writen':
rpc.o(.text+0x2cdb): undefined reference to `SSL_write'
rpc.o(.text+0x2ce6): undefined reference to `SSL_get_error'
collect2: ld returned 1 exit status
make: *** [ictest] Error 1
[root@crisium icsdk]#

I had been forewarned about this by an email from Jeff Butera saying that they added SSL support with UD6 and I need the openssl libraries installed on my system.

The SSL libraries in question are distributed with UniData 6 in triplicate. The files are libssl.a and libcrypto.a.

The ictest.mak file needs a small edit to make it link these libraries. Edit ictest.mak and change this line:

systemlibs = -lsocket -lnsl -lm -lc

To this:

systemlibs = -lsocket -lnsl -lm -lc -lssl -lcrypto


And finally, to compile:

[root@crisium icsdk]# make -f ictest.mak
cc -O -Dunix -I. -c ictest.c
cc ictest.o -L/usr/ud60/lib -luvic -lsocket -lnsl -lm -lc -lssl -lcrypto -o ictest
ictest.o: In function `getstr':
ictest.o(.text+0x31): the `gets' function is dangerous and should not be used.
[root@crisium icsdk]#

And to run:

[root@crisium icsdk]# ./ictest
Host: crisium
User: uduser
Password:
Path or Account: /data/ud/test
Session open!
Open of VOC returned status = 18
Read of record returned status 0
Size of record = 4
Record contents:
Field 01: V
Field 02: ED
[root@crisium icsdk]#

-- Wendy Smoak mailto:[email protected]