[Mono-list] P/Invoke, Mono, .NET and Windows XP funny platform

Francis Brosnan Blázquez francis at aspl.es
Thu Jun 9 13:23:44 EDT 2005


We have observed a somewhat curious behaviour that we don't know if it 
is a bug or
the windows XP linkers behaves this way. Let me explain it.

We are developing a distribuited application based on an Client 
interface written in C#,
using Mono, which runs over the af-arch platform (http://fact.aspl.es). 
That platform is
mainly written using C so we are P/Invoking from the client interface to 
the platform so
we have access to its services.

Under linux we have no problems running the application with any mono 
version. But under
windows XP platform (allways improving the programmer experience) we are 
running into
some troubles.

After compiling all libraries from the af-arch platform  to produce 
native dll we have found
the application hang ups randomly while running it. We are using the 
mingw tools to produce
native libraries which doesn't rely on cygwin1.dll.

After some time debuging the application we didn't found any thing which 
may lead to those
funny random hang ups. Then, we started to use dependency walker to 
figure out if we were
loading something like cygwin1.dll that would make the application 
break. But we found the
mono runtime was loading the same libraries the af-arch is liked to but 
not the ones we used
to compile the af-arch but the ones the mono installer comes with.

The af-arch mainly depends on glib-2.0 and libxml-2.0. Now, if we 
compile the af-arch using
the libraries that Mono installs the application run perfectly. If we do 
so using other libraries we
have downloaded the  hangs up.

So here are the question:

* Any application which p/invokes libraries that are also provided by 
mono must compile its native
dll versions against the mono dll or it is posible to compile these ones 
against, for example,
a glib not provided by the mono installer?

* What happens if the mono runtime detects a P/Invoke over a library 
A.dll which depends on
B.dll and then another P/Invoke over the library C.dll which depends on 
B'.dll knowing that
B.dll and B'.dll are the same library but not the same file?

Many thanks, cheers.

More information about the Mono-list mailing list