[Mono-devel-list] using mono to write a linux gui

Francisco T. Martinez martinf at mfconsulting.com
Fri Dec 17 12:14:26 EST 2004


Jonathan Pryor wrote:

>On Thu, 2004-12-16 at 20:37 -0800, Michael Geis wrote:
><snip/>
>  
>
>>The idea of CLR and CIL is still new to me: My so far understanding of
>>it suggests that once a C#  app has been compiled you can run it on
>>any platform if you have the required virtual machine(just as python
>>runs everywhere provided you have a python interpreter)?
>>    
>>
>
>This is mostly correct, though Microsoft's original C++ compiler greatly
>complicates matters.  The complication is that there is no guarantee
>that assemblies contain *only* CIL code -- they can contain a mix of CIL
>and native code, which (1) the original Managed Extensions for C++ did
>by default, and (2) isn't portable to non-x86 Windows platforms.
>
>Then there's the DllImport issue, but it's equivalent to using a Python
>library which only runs on Windows (say a Registry API).
>
>  
>
>> If this is correct, it seems I could choose the following approach:
>>Compile my C++ code under windows with the \clr switch (hoping that It
>>(really) Just Works) into the managed universe .The GUI app to be
>>written in C#  then should be able to use these modules naturally
>>(i.e. without P/Invoke etc.). Finally, I would compile the C#  with
>>mcs and run the whole thing with mono.
>>    
>>
>
>In order to get something that runs on Mono, you'd need to use
>"Whidbey" (which will probably become Visual Studio 2005; betas
>currently exist for it), and use the /clr:pure or /clr:safe options when
>compiling your C++ code.
>
>You could then use C# to write your GUI code, but you could also use 
>C++/CLI, and keep everything in C++, since C++/CLI permits full use of
>managed assemblies.
>
>In theory this should work properly under Mono.  In practice you'll have
>two issues:
>
>(1) Since you're using C++ you'll have to use Microsoft's tools.  This 
>    may not be a problem for you, and the resulting assemblies can be 
>    copied and executed under Mono.
>(2) You'll have to decide which GUI toolkit to use.  
>    System.Windows.Forms, for which Microsoft has the best support, is 
>    not well supported under Mono.  Support should be available with 
>    Mono 1.2, currently expected in the first half of next year.
>    Gtk# is the preferred toolkit to use with Mono, but it requires 
>    GTK+, so you'd have to provide an installer which installs Gtk#
>    and GTK+ in addition to your app.
>
>  
>
There is a mounting list of resources becoming available for 
developers/users of Gtk# running on top of Microsoft .NET Framework 
SDK/Runtime 1.1.  The following links could assist you in the 
exploration of programming and redistributing Microsoft .NET 
applications that use a Gtk# front end/GUI:

General location for a lot of Gtk# specific downloads and information 
for .NET Framework
http://forge.novell.com/modules/xfmod/project/?gtks-inst4win

Latest available stable release of the Gtk# Win32 Installer for 
Microsoft .NET Framework 1.1 SDK
(it includes a runtime version of GTK+ 2.2.4 as well as development 
libraries and tools)
(this also includes a couple of Visual Studio .NET 2003 C# Project 
templates for Glade# and Gtk#)
http://forge.novell.com/modules/xfcontent/downloads.php/gtks-inst4win/Win32%20Installer/v1.0.2.4/

Latest available stable release of the Gtk# Win32 Installer for 
Microsoft .NET Framework 1.1 Runtime
(it includes a runtime version of GTK+ 2.2.4)
http://forge.novell.com/modules/xfcontent/downloads.php/gtks-inst4win/Win32%20Runtime%20Installer/v1.0.2.4/

An MS Help 2.0 reference set about Gtk# that integrates with Visual 
Studio .NET 2003 MSDN documentation
http://forge.novell.com/modules/xfcontent/downloads.php/gtks-inst4win/Gtk-Sharp%20Help%20for%20VS%20.NET%202003/v0.1.0.1/

Some reference material like videos, screen shots and other.
http://forge.novell.com/modules/xfmod/docman/?group_id=1480

I think that the comments that Jon Pryor shared in his original reply 
are right on target when it comes to designing solutions that later may 
want to be run in other platforms. Please keep that in mind.

However, I wanted to share my opinion that using Gtk# with MS Framework 
is a viable option.

Paco





More information about the Mono-devel-list mailing list