loading and running windows dlls in a linux program

Stefan Sperling w9rk at gmx.net
Thu Jun 5 17:41:11 CDT 2003


Hi,

I want to write a program that uses audio plugins. I also want to
add support for a couple of plugins I use that are compiled as windows dlls. 
I know the interface the plugins expect, so there will be no real problem 
in this regard. But I will have to know about how to load a windows dll 
under linux and the potential obstacles involved in this.

I know that some other free programs are already loading windows dlls: 
mplayer loads foreign windows video/audio codec dlls and the cvs version
of soundtracker more or less loads so-called "buzzmachines".
Both of them use wine code to achive this.

I basically will have to do the same as soundtracker. The soundtracker
code uses wine code but it is pretty outdated (may 2001).
The actual code loading the buzzmachines is closed source because the
author of the original windows program using buzzmachines does not
want that code snippet to be free - so I cannot read it in plain C. 
But I can see what functions are being called in the object code (thanks nm).
Three of which come from wine:

         LoadLibraryA
         GetProcAddress
         FreeLibrary

Are these all I need? In theory, this looks about enough to be able to load
a shared object... but I will need a lot of other wine internals too,
in case a dll does a system call (like malloc, which will definitely happen),
won't I?

What happens if I pass a pointer to a method contained in a windows
dll?? Will wine take care about low level stuff like keeping track
of memory layouts of structs and convert them if they are incorrect?
More precisely: If I reimplement data structures external to the dll but 
used by it, will the difference in memory layout between the original 
struct the dll expects and my new implementation under linux matter?

Thanks
stefan




More information about the wine-devel mailing list