* [Linux-ia64] Cannot use div operator in shared libraries
@ 2000-06-07 8:26 Christoph Rohland
2000-06-07 10:18 ` Andreas Schwab
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Rohland @ 2000-06-07 8:26 UTC (permalink / raw)
To: linux-ia64
--=-=-
Hi,
Attached are to files to reproduce the error:
1) lib.c
2) dl_test.c
compile them with:
$ gcc -c lib.c
$ ld -shared -o lib.so lib.o -lc
$ cc dl_test.c -o dl_test -ldl
$ cc dl_test.c -o dl_test2 -ldl ./lib.so
And test the result with
$ ./dl_test
./dl_test: error in loading shared libraries: ./lib.so: undefined symbol: __divdi3
$ ./dl_test2
13/5 = 2
2
Also '$ ld -shared -o lib.so lib.o -lc -Bsymbol' gives:
lib.o: In function `my_div':
lib.o(.text+0x92): undefined reference to `__divdi3'
I am using turbolinux 0505.
Greetings
Christoph
--=-=-Content-Disposition: attachment; filename=lib.c
int my_div (int a, int b) {
int c;
c = a/b;
printf ("%d/%d = %d\n",a,b,c);
return c;
}
--=-=-Content-Disposition: attachment; filename=dl_test.c
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char **argv) {
void *handle;
int (*my_div)(int,int);
char *error;
handle = dlopen ("./lib.so", RTLD_LAZY);
if (!handle) {
fputs (dlerror(), stderr);
exit(1);
}
my_div = dlsym(handle, "my_div");
if ((error = dlerror()) != NULL) {
fputs(error, stderr);
exit(1);
}
printf ("%d\n", (*my_div)(13,5));
dlclose(handle);
}
--=-=-=--
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Linux-ia64] Cannot use div operator in shared libraries
2000-06-07 8:26 [Linux-ia64] Cannot use div operator in shared libraries Christoph Rohland
@ 2000-06-07 10:18 ` Andreas Schwab
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2000-06-07 10:18 UTC (permalink / raw)
To: linux-ia64
Christoph Rohland <cr@sap.com> writes:
|> Hi,
|>
|> Attached are to files to reproduce the error:
|>
|> 1) lib.c
|> 2) dl_test.c
|>
|> compile them with:
|>
|> $ gcc -c lib.c
|> $ ld -shared -o lib.so lib.o -lc
Don't call ld directly, use gcc instead.
--
Andreas Schwab "And now for something
SuSE Labs completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-06-07 10:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-06-07 8:26 [Linux-ia64] Cannot use div operator in shared libraries Christoph Rohland
2000-06-07 10:18 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox