loading and running windows dlls in a linux program

Stefan Sperling w9rk at dice.net
Fri Jun 6 05:23:50 CDT 2003


On Fri, Jun 06, 2003 at 08:47:31AM +0300, Shachar Shemesh wrote:
> Stefan Sperling wrote:
> 
> >But I can see what functions are being called in the object code (thanks 
> >nm).
> >Three of which come from wine:
> >
> >        LoadLibraryA
> >        GetProcAddress
> >        FreeLibrary
> > 
> >
> Hi Stefan.
> 
> What you just saw is the bare minimum you need in order to load a 
> library. I'm afraid, however, that it is far from all you need.
> 
> First, when you load another library, that library may need any DLL at 
> all. In order to assess how much of Wine you need, you need to also look 
> at the DLLs loaded. Also, please bear in mind that GetProcAddress can 
> load other functions, and those functions called.
> 

I don't think there will be a lot of dependencies on other DLLs, apart
from the standard C stuff (which is a lot already!). I can only think of one or two, 
and they do not belong to windows. I have them and I will load them as well.
What do I have to look out for when loading a DLL other DLLs depend on? 
If a DLL calls a function of another DLL, is wine managing the call for me or will my code 
have to be aware of this, granted I use winelib? Will the requested DLL be loaded automatically?
Is the standard C stuff covered by wine? What files from the wine source tree will I need so 
I have the apropriate code at hand?

What happens if a DLL expects functions from the windows environment in a certain 
windows DLL not yet implemented in wine? Anything else than my app 
crashing when those functions are called, that is? How could I provide
those functions myself? 

Bottom line: I have a lot of questions... Is there any documentation about this?
I don't want to bother the wine-devel mailing list too much with these problems since
they are not really concerned with developing wine itself.

> Wine invented something called "winelib executable". This is an ELF 
> library that can also link to PE DLLs. It appears that your best bet, if 
> you don't want to embark on massive copy/paste activity, is to create 
> your util as a winelib. There are some disadvantges to that as well (a 
> dependancy on Wine, for one).

Will this affect my whole app or can I tuck the winelib dependency away in a seperate module?
Again, I bet there's a lot of documentation on that in the sheer amount of wine docs, is there?

Stefan




More information about the wine-devel mailing list