I am mostly playing with F# on Linux and would like to get all the necessary GUI libraries (Gtk, Gdk, Atk, Glib, Pango, Cairo) to be referenced by default so that I can simply use:
without any additional typing.
open Gtk;;
My best guess would modifying the fsi launching script, which at the moment looks like that:
#!/bin/sh
exec /usr/bin/mono /usr/local/src/fsharp/bin/fsi.exe $@
Update: working version of the script as in Stephen’s suggestion:
#!/bin/sh
exec /usr/bin/mono /usr/local/src/fsharp/bin/fsi.exe -r "/usr/lib/cli/atk-sharp-2.0/atk-sharp.dll" -r "/usr/lib/cli/glib-sharp-2.0/glib-sharp.dll" -r "/usr/lib/cli/gdk-sharp-2.0/gdk-sharp.dll" -r "/usr/lib/cli/gtk-sharp-2.0/gtk-sharp.dll" -r "/usr/lib/cli/pango-sharp-2.0/pango-sharp.dll" -r "/usr/lib/mono/2.0/Mono.Cairo.dll" $@
I wrote a little script that allows you to use Gtk# from F# Interactive (see below). It references the necessary Gtk# assemblies (you may need to modify the paths) and it also configures F# Interactive event loop, so that you can create and display widgets (such as
Window) interactively.If you want to get the support automatically, you’ll need to run
fsi.exewith a parameter to load the script on startmono /.../fsi.exe --load:load-gtk.fsx(assuming that you save the script asload-gtk.fsx)