November 22, 2004

Be careful what you Import

I have a lot of material for many blog entries. However, I will try to keep it short and if you want me to elaborate, say so in this entry's comments section.

Todd Berman and I had been working towards a Gtk# Win32 Runtime for .NET Framework 1.1. Last Friday, we got closer than Todd thinks :). It turns out that we had it! We ran into a problem that may have far reaching repercutions for all users of the attribute [DllImport("")] that want to have their code work on Win32.

You see, Gtk# uses these Glue libraries. In Win32, an example of one of these guys would be glibsharpglue.dll for Gtk# 1.0.4 and glibsharpglue-2.0.dll for Gtk# 1.9

To make a long (we are talking 37 hours long) story short, the code in Gtk# 1.9 uses [DllImport("glibsharpglue-2.0")] and we all where hoping that windows would concatenate the appropriate *.dll file extension. Turns out that windows long file name rules and library file name resolution would look for a file called glibsharpglue-2 with the extension *.0, now of course, it was not finding it. So a word to the wise, either you fully qualify the file name as in [DllImport("glibsharpglue-2.0.dll")] or don't use '.' in your filenames (maybe go for [DllImport("glibsharpglue-2_0")] instead).

Here is a screen shot of the upcoming Mono Control Panel applet for Win32.

I should have it completed along with the two launchers when I get back from Puerto Rico on Dec 10.

The other thing I hope to have completed by the time of my return is a tutorial that may show you how to build Mono from SVN using Cygwin while mounting the directory where you installed the Mono Combined installer to /usr/local so you can use that as the bootstrap Mono for building XSP, and Gtk#. This is an obscure hack that I leared to do out of necessity but that has proven invaluable. If you think you are desperate enough I will then tell you that you begin by installing Mono combined installer 1.0.4 in C:\mono\Mono-1.0 if you are planning on building the 1.0 branch or install Mono combined installer 1.1.2 in C:\mono\Mono-1.1 if you want to build HEAD. Next you go to the register and add this to it (replace according to version)

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/local]
"flags"=dword:0000000a
"native"="C:\\mono\\Mono-1.1"

Restart Cygwin shell and do a:
$ which mcs

followed by:
$ mcs --version

Hope that holds you until I get back ;)

Posted by martinf at November 22, 2004 07:50 AM
Comments

Thanks for all the Win32 - Install stuff.
Can't wait to use it (Especially gtk# with MS - Runtime).

Keep on the good work!

Posted by: Phil at November 23, 2004 08:00 AM