Dear S-PLUS users,
I am looking for the experience of making dynamically loadable
shared library for S-PLUS 3.3 (Release 1 for DEC alpha, OSF1 V3.2).
I have tried the sample program in the S-PLUS manual book as
follows (sample.c)
#include <S.h>
void my_sum(double *x, long *n, double *sum)
{
long i;
*sum = 0 ;
for (i = 0 ; i < *n ; i++)
if (is_na(x[i], DOUBLE)) {
na_set(sum, DOUBLE);
break;
}
else *sum += x[i];
}
If I compile it by "Splus SHLIB sample.c", I get following message:
targets= -f /math/packages/splus33/newfun/lib/S_soMakefile sample.so
make -f /math/packages/splus33/newfun/lib/S_makefile -f
/math/packages/splus33/newfun/lib/S_soMakefile sample.so
"SHLIB=sample.so" "OBJS= sample.o"
cc -c -taso -ieee_with_no_inexact -I${SHOME-`Splus SHOME`}/include
-Olimit 3500 -O4 sample.c
ld -o sample.so -shared sample.o
ld:
Warning: Unresolved:
test_na
set_na
__exc_add_pc_range_table
__exc_remove_pc_range_table
__exc_add_gp_range
__exc_remove_gp_range
sample.so
I can load sample.so by
dyn.load.shared("./sample.so", symbols=symbol.C("my_sum"))
but if I use it in .C(), I get an error message "System terminating:
bad address" and S-PLUS terminates. I think the error is caused by
the unknown references. However, I couldn't figure out how to resolve
the unknown references. I thought the unknown references should be in
a file named Sqpe.so and it should be linked by ld when creating
sample.so, but there is no such or similar file in the SHOME
directory.
I found this problem when I tried to port my C programs to DEC alpha
OSF1 from Sun Solaris. Any advice is highly appreciated.
Thanks.
Paul.
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|