Is it possible, via Wine, to link against a Windows DLL in a C++ program compiled under Linux? My specific situation: I would like to interface a piece of hardware over a serial port. The manufacturer refuses to provide a serial comms specification for the device "because it's proprietary", but they will happily provide a Windows DLL that can be used to control the device. Any chance of using it under Linux? thanks
--Jim Morash
Hi Jim,
You might actually do best turning the problem upside down.
That is, it's quite easy to write a .exe or winelib application that links to a Windows DLL and connects to a Linux binary or library.
It's hard to call Wine as a library, because Wine has to have quite a lot initialized (that's code for you really don't even want to try :-/).
Hence, if you think of the problem as one of having a Winelib app call your Linux C++ code, you'll probably succeed.
On a different tangent, though, if I were in your shoes, I'd write a simple Windows .EXE file (and test + debug it on Windows) that used this DLL to communicate with this device but then took commands via a socket interface.
You can write the code on the Linux side to operate the socket interface, and once it's working well with a Windows device, step over and get it to work with Wine as well. That lets you eliminate Wine's bugs from your own development effort initially, but then later circle around to make sure you get them out.
Others may argue you should start with a Winelib app first and foremost, and they'd be morally right; I'm just trying to be practical. <grin>
Cheers,
Jeremy
Jim Morash wrote:
Is it possible, via Wine, to link against a Windows DLL in a C++ program compiled under Linux? My specific situation: I would like to interface a piece of hardware over a serial port. The manufacturer refuses to provide a serial comms specification for the device "because it's proprietary", but they will happily provide a Windows DLL that can be used to control the device. Any chance of using it under Linux? thanks
--Jim Morash
Jim Morash wrote:
Is it possible, via Wine, to link against a Windows DLL in a C++ program compiled under Linux? My specific situation: I would like to interface a piece of hardware over a serial port. The manufacturer refuses to provide a serial comms specification for the device "because it's proprietary", but they will happily provide a Windows DLL that can be used to control the device. Any chance of using it under Linux? thanks
--Jim Morash
I think you may build a winelib application that uses LoadLibrary() to load the DLL at runtime, then query the entry points for the interesting functions. You can even use C++ (wineg++). But if I were in your case (unknown protocol over standard serial port, no specs from manufacturer), I would consider compiling bochs (http://bochs.sourceforge.net/), installing Windows inside, along with a win32 app that uses the port, then modify bochs in order to log the serial port communication between the virtual machine and the hardware port. If the DLL is the only thing that ties you to Windows, then you would be the proud owner of a native Linux program that interacts with the hardware. I know this is possible, because I did the exact same thing in order to figure out a parallel-port protocol for a MP3 player that was initially Windows-only.
Alex Villacis Lasso