From: nino@complang.tuwien.ac.at (Marinos Yannikos)
Subject: dlopen limits
Date: 1995/11/17 [thread overview]
Message-ID: <48i16o$b9t@news.tuwien.ac.at> (raw)
I noticed that it is not possible to dlopen() more than 95 shared libraries
at the same time under Digital Unix 3.2a. Is this an arbitrary limit, or
is there some other reason, like efficiency problems, for this? Appended
below is a program that shows the problem (it will fill up your current
directory with func_*.{c,o,so} files).
Thanks,
-nino
PS. If you can get this to work with more than 95 functions on 3.2c or better,
please let me know!
--- 8< ---
#include <stdio.h>
#include <dlfcn.h>
#define N 200
void *h[N];
int (*func[N])();
main()
{
FILE *f;
int i;
char s[100];
for (i=0; i<N; i++)
{
fprintf(stderr, "Function %d\r",i);
sprintf(s,"func_%d.c",i);
f=fopen(s,"w");
fprintf (f,"func_%d(){return 1+%d;}",i,i);
fclose(f);
sprintf(s,"cc -c func_%d.c; ld -shared func_%d.o -o func_%d.so -lc",i,i,i);
system(s);
sprintf(s,"func_%d.so",i);
h[i]=dlopen(s, RTLD_LAZY);
if (h[i]==NULL) {fprintf(stderr, "\nError: %s\n", dlerror()); exit(1);}
sprintf(s,"func_%d",i);
func[i]=dlsym(h[i],s);
}
for (i=0; i<N; i++)
{
fprintf (stderr, "Testing %d\r",i);
if (func[i]() != 1+i)
fprintf (stderr, "\nError in function %d!\n",i);
}
}
--- >8 ---
--
http://www.complang.tuwien.ac.at/nino
next reply other threads:[~1995-11-17 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-11-17 5:00 Marinos Yannikos [this message]
1995-11-21 5:00 ` dlopen limits Steven Winikoff
1995-11-21 5:00 ` David Metsky
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox