thread safing dlls

Michael Zayats zmichael at regard.co.il
Mon Dec 3 07:09:45 CST 2001


this might be off topic, but let's try:

I have a dll that is not thread safe (i.e. has many global variables, about
500). I have the sources for the dll.
The target is to make it thread safe.

Moving all the variables to thread specific storage is very complicated.
Making it thread safe on ansi C level is very, very complicated too. I guess
that you thoroughly deal with PE format.

Is there a way to play with executable sections, such that every thread will
use it's own copy of the data?

I know one guy, that claimed that he has achieved this with 20 lines of code
by directly modifying smth in executable, he doesn't want to tell me what he
has done :(

I also heard of __attribute((section... in gcc that should do the work (I am
generally talking about windoze platform only), can you explain me what does
it do in gcc?

thank you in advance,

Michael Zayats





More information about the wine-devel mailing list