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 07:50 AM | Comments (1)

November 18, 2004

So much to do so little time - before IFLOSS in Puerto Rico

Sabastien Pouliot, the titan of Mono security, has rebuilt a Win32 system of his and used my custom Cygwin CD to do a build of Mono from source. His feedback along with Atsushi Enomoto's comments (the XML wonder and Paco CD evaluator extraordinaire) have been the highlight of my week. I have done some new work on the Cygwin installation since the advent of 1.1.2 builds, so you may expect a new version of the Cygwin CD that will allow compilation of the 1.0.x code base as well as the 1.1.x. to be shipped to Novell/Ximian HQ for final disposition.

Along the testing lines, I will like to mention Simon Bain, Sankar Ramalingam, Alain Favre aka "Prettyfly", Paulo Pires and a special thanks to Angel Marin for spotting a big omission on my part for the installation of Mono without any GTK or Gtk# selections.

I have whipped out a new rendition of the installer with some fixes already. Once again I ask for you folks to give it another look over and to kick the tires some more.

Runtime Environment Selector


I am going to create a control panel applet that will work in tandem with the two Mono applications launchers I am writing. The applet will be deployed along with the launchers in its own installer.

The main purpose of this control panel applet is to set the default installation of the Mono runtime to use by the Mono Launcher apps. This will be necessary as users choose to install the 1.0.x and the 1.1.x distributions in a side-by-side fashion. In turn, the launchers will come in two flavors, monoLaunchW.exe for Gtk# apps that we want to launch without the sometimes unsightly Win32 Console window and monoLaunchC.exe which will be intended for applications that want to have their output to stdout shown (great for debugging purposes).

Why, why, why!


A Microsoft Evangelist that thinks Mono is bad for Microsoft (therefore the whole of mankind), asked me the other day why I keep using Windows Forms for some of my development instead of Gtk# -- if is so great. :)

Well, I don't use that much Windows Forms, I have used it so sparingly for non sample work (in the options dialog box for the VSProj2Make add-in for Visual Studio 2003). But what I still use and will use some more of, is either straight Win32 SDK GUIs or MFC/ATL assisted GUIs.

Being that I do a lot of Installer work, I can't count on having Gtk#, Mono or even the .NET Framework installed already when my helper apps are launched. Therefore I have to do native programming still in Win32 :(. I am beginning to look at Windows Template Library (WTL) (again) for some of the components. The last time I looked into WTL it was still being distributed with the Platform SDK back in Oct 2001, and it was not my cup of tea. So far, when I am forced to do complex Win32 GUIs, I tend to do MFC statically linked.

Let's hope that this new WTL thing is friendlier to an Open Source program and as efficient (will settle for close enough) as straight Win32 SDK programming.

I only have 4 working days before leaving for Puerto Rico.

Posted by martinf at 07:17 AM | Comments (6)

November 17, 2004

New Mono Installer for Win32 -- Finally, 1.1.2!

After a grueling two weeks I have finally completed a first pass at the Mono 1.1.2 and Gtk# 1.9 Combined Installer for Win32.

Please read the email I sent yesterday to the list Mono-delvel-list

archives/public/mono-devel-list/2004-November/008830.html

THIS IS A PREVIEW RELEASE and may have more tweaking based on your feedback.

I am currently, working on some "Runtime improvements that will be very specific to Win32". These will be aimed at simplifiying application launching and coexistace between different versions of Mono installed on a Windows machine.

More to come in the next few days.

In the Linux front, I have been working with Ubuntu, SuSe 9.2 Professional and Novell Linux Desktop. My main computer for traveling is a Compaq Presario that is built like freaking truck and weighs about as much :)

This is an AMD 64 Athlon, 1 GB RAM and 60 GB hard disk that has an nVidia GForce 400 MX. I now have it configured With SuSe 9.2 Pro, NLD and Windows XP. Grub does all of the boot management. I am happy.

News about Paquito: I have not heard from him since the Falluja offensive started. As I tell friends and family, I have not heard from the Dept of the Army either -- so that is very good news.

I am so ready for IFLOSS in Puerto Rico. Kevin was telling me that I may become the Keynotes Speaker :)

Posted by martinf at 07:02 AM | Comments (1)

November 08, 2004

Nicer launching of Gtk# Applications in Win32

I have completed my first pass at monoLaunch.exe. This little utility is a Win32 SDK C/C++ application that can be used to launch Gtk# applications using the Mono runtime without opening the sometimes referred to as "unsightly" console window (the window for stdout, stderr and stdin).

This app is somewhat clever in the sense that it goes to the registry and based on the contents of \\SOFTWARE\Novell\mono\DefaultCLR key it gets the location of mono.bat to use it as the executable in the CreateProcess call. What this in turn means is that you can put monoLaunch .exe in the system directory and as the mono installers evolve it will likely always launch your Gtk# executable using the latest mono runtime without you having to jack with path statements and the like.

I will be putting together a quick tutorial that shows how to create a short-cut to an application in the Start Menu using monoLaunch. Shortly thereafter, I will make an installer available for monoLaunch at:

http://forge.novell.com/modules/xfmod/project/?monowin32

In the mean time you can start looking at some source code if you care to.

WARNING: Monoers may convulse when looking at Win32 C/C++ that uses Hungarian notation, _T() macros and little comments.

Posted by martinf at 07:10 AM | Comments (4)

November 05, 2004

ˇAsí se Compone un Són!

Mono is FANTASTIC and Microsoft .NET is very good.

In fact, MS .NET was one of the best things that happened to programming in the year 2000. It did not happen overnight either. It was the result of a number of evolutionary changes that are rooted in things like C/C++ from AT&T, COM from Microsoft, Java from SUN Microsystems and many other technology hits.

Mono is in principle, closely related to the MS .NET Framework. Specially those parts that were created as a result of the study of the ECMA-334 C# Language Specification and multilateral collaborative efforts of the members that work with the ECMA standardization of the C# Language, the runtime and other pieces.

Now, what makes Mono awesome is not its ability to imitate or reproduce existing Microsoft technologies, but rather the promise to make other great NON-MICROSOFT pieces available to ALL operating systems that Mono can be made to run on. Windows happens to be an operating system where Mono can run.

If you have not notice me yet, I am the fellow that has made a personal commitment to empower Windows with some (I wish I could say all) of the great libraries and emerging applications that are available in the other premier platforms in which Mono runs.

There are a lot of Windows users that have not discovered the wonderful benefits of SuSe, Ubuntu, FreeBSD, Mac OS X and many other very good operating systems and platforms. I felt that it would be nice to bring some of those advances to their side of the fence.

I have given the preceding paragraphs to put in context the statement that I make now:

Mono's future does not have to be dependant on the Microsoft's strategic plans for Windows and/or the .NET Framework. I personally believe that end users, software engineers and IT decision makers will be the ones that will clamor for Mono on its on merits. Furthermore, Microsoft Corporation may even choose to emulate functionalities and advances that originate within Mono because it will make sense in their quest to increase share holder value.

You now understand why I am not obsessed in having Mono perfectly replicate pieces of technology or functionality that are proprietary to Microsoft or just favored by them. Cross platform compatibility is very important to me. However, I rather look at an open source code base and empower systems that are NOT open source themselves than the other way around.

Paco's simple diagram:

So anytime I design or code a .NET Framework solution while in Windows, I do so hoping that I can be compatible with Mono.

By the way, this is not the first time I have been so smitten with an operating system or development platform. In 1987 when I discovered computers I was convinced that Microsft Windows was going to be the biggest thing in my live for the next few years. I admit that OS/2 was looking even better but I could not afford OS/2 and its development tools. It was Microsoft and Tandy Computers who back then made it cost accessible for this United States Air Force E-4 to learn and play with computer technology. It is about empowering people.

Linux and Mono empower people.

Posted by martinf at 06:52 AM | Comments (1)

November 04, 2004

Guess what this does


SECURITY_ATTRIBUTES SecAttib;
SECURITY_ATTRIBUTES ThreadAttrib;
STARTUPINFO StartUpInfo;
PROCESS_INFORMATION ProcInfo;

ZeroMemory(&SecAttib, sizeof(SECURITY_ATTRIBUTES));
ZeroMemory(&ThreadAttrib, sizeof(SECURITY_ATTRIBUTES));
ZeroMemory(&StartUpInfo, sizeof(STARTUPINFO));
ZeroMemory(&ProcInfo, sizeof(PROCESS_INFORMATION));

StartUpInfo.cb = sizeof(STARTUPINFO);

::CreateProcess(
NULL,
_T("C:\\mono\\Mono-1.0\\bin\\mono.bat C:\\mono\\Mono-1.0\\lib\\prj2make-sharp-gtk.exe"),
&SecAttib,
&ThreadAttrib,
TRUE,
CREATE_NO_WINDOW,
NULL,
NULL,
&StartUpInfo,
&ProcInfo
);


Let me know if anyone is interested :)

Posted by martinf at 08:13 PM | Comments (5)

November 01, 2004

A New Day

Over the weekend, I released a new Mono combined installer for Win32 that is based on 1.0.4 technologies (Mono 1.0.4, Gtk# 1.0.4 and XSP 1.0.4). The Gtk# UI portions are still based on GTK+ 2.2.4 for Windows.

The "tricked-out" Cygwin installation that I have put together proved itself invaluable for this release. The time it took to produced 1.0.2 was about 18 hours. For 1.0.4 it took about 6 hours. There are a lot of advantages to building Mono and it's associated technologies with the Mono C# Compiler and the Mono Runtime over using the Microsoft .NET Framework 1.1 SDK. The building of a few of the pieces (Novell.Directory.Ldap and Mono.CSharp.Debugger to mention a couple) would make a grown man cry unless built with an All-Mono suite.

The next step in the realm of Mono for Win32 installers is the Gtk# SDK and Gtk# Runtime for 1.0.4. I also have to update the Visual Studio Add-in to build and deploy on systems using 1.0.4. Prj2make-sharp has been neglected and should be upgraded to handle Visual Basic .NET 2003 projects since I understand that the Mono BASIC (mbas.exe) has made such progress! I am now studying the possibility of a development or technology preview installer for Mono 1.1.2 and the Gtk# in HEAD CVS that is intended to bind to GTK 2.4.

I devoted a sizeable amount of time building Gecko# in Win32. I decided to stop work on Gecko# for Win32 until Mark Crichton contact me. I sent him an email asking him for his Mozilla configuration file (.mozconfig) and he has either not seen it yet or has not been able to reply. I managed to build Mozilla 1.7.3 from source in Win32 - for those who have never tried that, let me tell you that it is an adventure in itself! - but now need to tell it is using --enable-default-toolkit-gtk2 but somehow not use X windows in the process.

Looking for a quick win, I turned to "mod_mono.so" on Apache 2.x Windows version. Like Mozilla and other fine cross-platform projects it is tricky to just build the Win32 version from source. As you may know, I have a fairly strong background on Win32 C/C++ development using Microsoft Platform SDK and things like MFC/ATL technologies. It is challenging to due away with that knowledge or at least shelve it in favor of the Netscape Portable Runtime (nspr) or the Apache Portable Runtime (aspr) to work inside these projects. I am so tempted to do a ::CreateProcess to invoke mod-mono-server.exe as opposed to a apr_proc_create call.

Then I read the email thread in the Mono mailing list spawned by the message titled "Ask Microsoft: Mono support". I felt ready to discontinue work towards any Microsoft related product ever again for fear of feeling like a Nazi collaborator. It so happens that out of all of the other Monitos that are friends of mine, I am the one that has decided to do all of the Win32 empowerment. That's right, my work actually makes it so that if you are a Windows programmer you can still enjoy all of the work that the Mono, Apache and Mozilla communities donate from within the Microsoft OS and with Microsoft Visual Studio. Heh, one could even argue that this sells Microsoft software.

Message from Paco to Microsoft: Cut that out, grow up and stop the FUD. The days of becoming obscenely rich with closed-software sales are over. A new dawn were communities collaborate, share and participate with some degree of harmony has arrived. If you can't play nicely, you will not be picked by any team and even if you own a bat, glove and ball, you will be sent home packing. Just because you are a rich kid does not mean that I will not play with you, but don't think for a moment that you are indispensable. You may find yourself having to play with your butler in your back yard all by your self.

Finally in a quest for happiness and fun I installed Ubuntu in a desktop computer and an old notebook one. I love it! The installation was almost child proof and when it was all done a beautiful GNOME desktop strongly reminiscent of XD running on Red Hat 9.0 emerged. Oh my God! It is so cool, and my wireless PCMCIA Card on the notebook worked out of the shoot. Thank you Edd Dumbill for the recommendation.

Now, is just a matter of getting out of Iraq and obtaining all the new Novell OSes (SuSe 9.2 Pro, Novell Linux Desktop, etc.) released and we will all live in a better world!

Posted by martinf at 06:25 AM | Comments (2)