s-news
[Top] [All Lists]

calling C from within Splus

To: s-news@lists.biostat.wustl.edu
Subject: calling C from within Splus
From: "Zeynep Isil Kalaylioglu" <zikalayl@unity.ncsu.edu>
Date: Tue, 24 Apr 2001 14:02:14 -0400
Hi

I am running Splus3.5 on

Machine hardware:   sun4u
OS version:         5.6
Processor type:     sparc
Hardware:           SUNW,Ultra-5_10


I am calling a C code from within SPlus. I have a command in my C code which
generates random numbers. This command is imsls_d_random_chi_squared. When I
compile and run C alone, it works fine. But when I call it from within Splus it
says imsls_d_random_chi_squared is an undefined symbol and so doesn't work. To
handle the problem;

1)I have compiled my C code and made my object file test.o by using the command
  cc $CFLAGS -c runfile test.c $LINK_CNL  where
  $CFLAGS is -mt -fsingle -DANSI -I/afs/bp/dist/imsl401/CTT3.0/include and
  $LINK_CNL is -R/afs/bp/dist/imsl401/CTT3.0/lib/lib.solaris
-L/afs/bp/dist/imsl401/CTT3.0/lib/lib.solaris -limslcmath -limslcmathsup_imsl
-limslcstat -lm -lsocket -lnsl

2)I went to the directory  /afs/bp/dist/imsl401/CTT3.0/lib/lib.solaris. Here is
what is in this directory:
imslerr.bin              libimslblas.a            libimslcmathsup_perf.so
imslerr.dat              libimslblas.so           libimslcstat.a
imslfnl.dat              libimslcmath.a           libimslcstat.so
imsls_e.bin              libimslcmath.so          libimslmpistub.a
imsls_e.dat              libimslcmathsup_imsl.a   libimslp_err.a
libimsl.a                libimslcmathsup_imsl.so  libimsls_err.a
libimsl.so               libimslcmathsup_perf.a


3) I searched to find the symbol imsls_d_random_chi_squared by using nm and
grep commands as follows
  nm -o *.so | grep imsls_d_random_chi_squared
  Here is what I got:

[563]   |000000003020|000000000434|FUNC |GLOB |0    |1
     |imsls_d_random_chi_squared
[837]   |000000727170|000000000434|FUNC |GLOB |0    |1
     |imsls_d_random_gamma
[611]   |000000736460|000000000414|FUNC |GLOB |0    |1
     |imsls_d_random_normal
[389]   |000000745150|000000000414|FUNC |GLOB |0    |1
     |imsls_d_random_uniform

  That means I found my missing symbols
3)I loaded them prior to running my SPlus code by using the following command
 ld -r -dn -L /afs/bp/dist/imsl401/CTT3.0/lib/lib.solaris -o deneout.o dene1.o
-limslcstat

4)Then to check if I solved the problem I did
ld -zdefs -o deneout dene1.o

5) Unfortunately it looks like I haven't solved it yet. I got the following:
Undefined                       first referenced
 symbol                             in file
log                                 dene1.o
imsls_d_random_chi_squared          dene1.o
sqrt                                dene1.o
printf                              dene1.o
exp                                 dene1.o
free                                dene1.o
.div                                dene1.o


I wonder if you have experienced the same difficulty.

Zeynep Kalaylioglu
Department of Statistics
North Carolina State University







-- 
Zeynep Isil Kalaylioglu

<Prev in Thread] Current Thread [Next in Thread>
  • calling C from within Splus, Zeynep Isil Kalaylioglu <=