[Mono-devel-list] Pinvoking windows dll on linux?

Jonathan Gilbert 2a5gjx302 at sneakemail.com
Wed Dec 8 08:53:25 EST 2004


At 10:34 PM 07/12/2004 -0800, Lehel Kovach wrote:
>Is it possible to use DllImport to call a function from a 
>windows-native-code dll on Linux if the Linux machine has something like 
>Wine installed, or would this take some hacking?

It would take severe hacking. As I understand it (it was explained on one
of these lists a loooooooong time ago), libgc and WINE both want their own
thread extensions, and the two do not currently mix. What would be needed
would be a sort of hybrid: WINE with libgc built into it. The GC internals
would probably need to change somewhat, but if the public interface stayed
the same, it should in theory be possible to set up mono to run as a
process adjunct to WINE, using WINE's libgc and the combined threading.
Then, WINE's Win32 API could be used to load Win32 DLLs and invoke methods
within them.

The WINE/libgc threading incompatibility was found while the WINE-based
System.Windows.Forms implementation was still being pursued. WINElib
provided a partial fix to the "how can WINE be used without taking over the
entire process" problem, but problems between libgc-controlled threads and
WINE-controlled threads became apparent. WINElib wasn't even a particularly
safe hack of WINE, and the WINE maintainers refused to consider adding it
to the main WINE distribution. It was these difficulties, I believe, that
caused the WINE-based implementation to be ditched.

All this, by the way, is just regurgitation of something I read in a
message written by someone else a year or two ago; it's possible the facts
aren't quite right or that I have remembered it incorrectly :-) Still, it
should give you somewhere to start from (at the very least, an ancient
message to search for with more specific details of the problem).

Jonathan Gilbert




More information about the Mono-devel-list mailing list