How to use a windows dll in linux

Jeremy White jwhite at winehq.org
Thu Aug 31 12:52:20 CDT 2006


Dan Kegel wrote:
> On 8/30/06, Mark Smith <mesmith.18885136 at bloglines.com> wrote:
> 
>> I know this question has been asked many times, but I cannot find enough
>> information to solve the problem.
>>
>> I have a windows dll and header files. I want to make a library that I
>> can link to and use on linux. What are the steps required to do this?
> 
> 
> Sorry, you can't.   Not at the moment, anyway.  That's on the to-do list.

It's not that black and white, is it?

I believe you can, and it actually works reasonably well.  BUT there's
a big catch - you have to make your program into a Winelib application.

That is, what you (reasonably) want is just a simple foo.so you can
dlopen and then do invoke_my_windows_function().

You can get that, but what you have to do is rename your main
to be linux_main, and then write a whole new WinMain which invokes
your linux_main.

Then, from within your linux app, you can write some glue to
make the connectiong.

You can get into trouble if you depend heavily on particular
IPC mechanisms, threading in particular, but I believe that
basic usages should still work.

So, basically, if you're willing to stand your application on
its head, you can get the functionality you want.

Most people don't get over that; to be frank, I think those
that don't are largely just stuck on the 'smell' of it;
from a practical standpoint, I think it works fine.

Cheers,

Jeremy



More information about the wine-devel mailing list