Alexander Indenbaum <[EMAIL PROTECTED]> writes:

> Hi!
> 
> We develop product using Linux / GCC.
> 
> We have problems with run time linking with dll ( .so ) using
> dlopen/dlsym. The problem is that global symbols of program and library 
> with the same name are getting merged when dlopen() executed ( having
> global symbols as a bad design is another question :{) ) As result API 
> function from dll call causes changing of internal data in main program
> which is obviously is not desirable at all.
> 
> How it can be prevented?

Disclaimer: I don't have much experience with dlopen().

I suppose a general solution would be to take care that the globals in
your program have non-clashing names, e.g. prepended with a prefix.
It might not be a big problem to do that with a sed/awk/perl/elisp/etc
script. Having such prefixes is a good design idea in general, on top
of thinking hard whether you need those globals in the first place.

If that is not feasible or desirable for some reason, can you tell us
how you call dlopen(), i.e. with what flags? It would be best if you
could isolate the problem is a short example (of the size of the
examples in the dlopen() man page), preferably with nothing but
standard libs used. Surely you can write something that will conflict
with something in, say, libm, can't you? If you do that, the problem
will be easier to reproduce, investigate, and dealt with. Without it,
it is not clear.

-- 
Oleg Goldshmidt | BLOOMBERG L.P. (BFM) | [EMAIL PROTECTED]
"... We work by wit, and not by witchcraft;
 And wit depends on dilatory time." - W. Shakespeare.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to