Mike Hearn m.hearn@signal.qinetiq.com writes:
Hmm, when was this problem last discussed? I'd like to read about it. I seem to recall something about C++ static initializers, which is one reason why you need this wrapper thing (to init winelib before the app starts), but what is this about intercepting variables?
The way we link functions is by creating an intermediate jump that we can resolve ourselves. Obviously this doesn't work for variables, there's no way to insert an extra indirection, so we would need to work directly with the ELF tables, or else have the compiler generate PE indirections for us.
Is the problem with altering the GOT a matter of writing a parser, or figuring out which entries are variables, or something else?
It's a matter of doing the ELF run-time linking ourselves, so that we can use PE libraries to resolve imports. We may also need something at link time so that the ELF linker can be tricked in believing the variables exist. Basically it's a major piece of work, that I doubt will be done soon, if ever.
Other possibilities include building as PE format, which should work today, or using ELF linking throughout and giving up on native libraries, which would still require a bit of work. The latter is probably the best choice for Winelib, but since it's useless for the binary emulator it's not really high priority.