In my mono application I have PInvokes that run on both Windows and Linux and 
in my experience it works and you don't even have to change the source code 
from ".dll" to ".so".  If you put the module name only in the source code then 
the right thing happens.  The MS.NET knowns to append ".dll" when looking for 
the file and Mono knows to try both ".dll" and ".so" when running on Linux.

   Additionally, I think there's something about an xml file you can put in the 
same directory as your assembly that acts as a mapping where you can tell mono 
"when looking for foo.dll you should try bar.so" that you can use if you don't 
want the Windows and Linux libraries to have the same name.

  Of course you have to pay close attention to using the correct decorations 
for calling conventions on both libraries.


-----Original Message-----
From: mono-winforms-list-boun...@lists.ximian.com 
[mailto:mono-winforms-list-boun...@lists.ximian.com] On Behalf Of mcgd
Sent: Thursday, December 18, 2008 5:42 AM
To: mono-winforms-list@lists.ximian.com
Subject: [Mono-winforms-list] Porting application that calls windows and other 
DLLs


Hi,

I've been asked to try and get a .NET 1.1 application working under Mono. 
It makes quite a few Windows API calls, but also calls several other DLLs
using PInvoke.  Most of these DLLs can probably be recompiled under Linux,
but probably not all.

>From looking around, it seems that it's not possible to call Windows DLLs
via PInvoke using Mono, but I wanted to make sure this is the case.  Someone
mentioned something called "ctypes" as a way of doing this, but this seems
to be a Python thing.

I'd appreciate input on what my options might be available here, and whether
it's worth trying to go further.  A few other specific questions - answers
or URLs appreciated:

- Is there any way at all to get the equivalent of calls into User32.dll?  
Most of these are in User32.dll.  The application is very GUI-intensive.

- Is it possible to use Wine to run the DLLs?  I've seen references to this
idea, but I don't think I've found anything concrete.

- If the other DLLs could be recompiled into .so files under Linux, can I
use PInvoke without changing anything except ".dll" into ".so", or do
parameter names and types need to be changed too?  (i.e. would this possibly
be a significant porting effort in its own right?)
-- 
View this message in context: 
http://www.nabble.com/Porting-application-that-calls-windows-and-other-DLLs-tp21071161p21071161.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.

_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Reply via email to