Hello, [sorry if this post is off-topic, or if some of you have already seen it in some newsgroup. But I obtained absolutely no answer... If someone knows a better place to ask, please tell me.] I'm trying to re-use existing library functions working on static data. And I'd like to bind some of these data symbols to run-time allocated objects. I believe it could be possible with libdl mechanisms. If I've well understood, when dlopen()'ing a shared library : 1) the run time linker loads it into fresh memory, 2) and substitutes in it references to undefined symbols to their actual addresses ("relocation"), in the heap. So far I've been able to bind some static symbols to heap allocated store (look behind example code) But what I'd like to do is to *choose myself* the address where these symbols will be resolved (this because these are already constructed objects). In fact, dissociate memory allocation in the heap (already done elsewhere) from symbol relocation. Would there be a way do to such a thing ? Here's some code to illustrate : *** assume this is a piece of an old library I can't recompile : /* sub.c */ /* old static declaration */ int myData[100]; void oldSub() { printf("I'm working on data beginning at %x\n", myData); /* ... = myData[...] ; ...work... */ } *** here is the standard, static usage : main() { /* ...work... */ oldSub(); } At execution we can see that memory for myData[] is in the bss segment : > $ a.out > I'm working on data beginning at 80495e0 *** But I may build a shared object from sub.o and dlopen() it : cc -shared sub.o -o sub.so main() { void *handle; void (*theSub)(); handle = dlopen ("./sub.so", RTLD_NOW); theSub = dlsym (handle, "oldSub"); (*theSub)(); } And now at execution memory for myData[] is in the heap : > $ a.out > I'm working on data beginning at 2aac0760 So, after all, what I'd like to do would be to tell dlopen() that I've managed to allocate memory for myData object, and now it only has to resolve the 'myData' symbol to this given address. Any hint ? Thanks a lot in advance, -- Robert Riviere ([EMAIL PROTECTED]) Tel: .4-92-38-7906 CERMICS / INRIA Fax: .4-92-38-7740 BP 93 06902 Sophia Antipolis Cedex - La vérité est ailleurs, elle est dans le Stroustrup - -- To unsubscribe: mail -s unsubscribe [EMAIL PROTECTED] < /dev/null