There are a lot of folks who want to learn how to write software, I hear. So I’ll see if I can write something up about it.
I’m going to assume that the reader has at their disposal an i386-class computer running Ubuntu or Debian. This will all probably work for other operating systems, but it’s what I’ve got, and I’m not going to bend over backwards. :) I’m also going to write it in C#. Get over it. If something doesn’t work for you, if I miss a prerequisite or whatever, you can send me an email and I’ll fix the post.
Install the C# compiler
$ sudo apt-get install mono-gmcs
pretty easy, eh?
create a workspace
$ mkdir -p ~/src/greeting
Also pretty easy.
Write a simple app
$ cd ~/src/greeting $ cat > Greeting.cs // This brings in Console.Writeline, used below using System; class Greeting { // This is the program entry point public static int Main( string [] argc ){ // A simple operation to confirm that our app is running: Console.WriteLine("Greetings, World!"); // Well-behaved software returns an int from Main return 0; } } ^D
Compile the app
$ gmcs Greeting.cs
Run the app
$ ./Greeting.exe
Greetings, World!
Summary
Okay, so that’s not all that impressive, I know. I’m starting small. I intend to teach folks how to write an autotools package, including support for producing and consuming pkg-config bits (app-name.pc files), internationalization, etc. It’ll be fun, really. Just give me a little while to get it finished. :)
10 responses to “Writing Free Software – Part 1”
I believe, in C# it doesn’t really matter whether your Main() returns void or int, because it is the System.Environment.ExitCode that is being returned to the shell anyway. Conversely, in C and C++ main() must return int. And thanks for an intro into autotools, that’s exactly what I need to learn now.
Debian… awesome :) ………. C# ? srsly? :( Such an emotional roller-coaster!
I love C#. You should try it before you knock it. It’s a beautifully designed language.
I never really gave it a chance I guess, because:
1. # is the pound or hash symbol, doesn’t mean “sharp”
2. It’s just Java re-hash-ed ;)
3. Microsoft…. (shivers)
But I have heard it’s pretty good, perhaps I will swallow my pride and try out C-pound sometime
More evidence of Microsoft just being corporate thieves of everything free and awesome:
http://en.wikipedia.org/wiki/F_Sharp_(programming_language)
“The F# Software Foundation (FSSF), is a non-profit organization devoted to the F# programming language.”
Sounds like a serious rip-off of Richard Stallman’s FSF (Free Software Foundation), open-source, and just a generally dirty trick.
Microsoft …. devils of the computing age imo ;)
Meh, it’s a big company. The parts I associate with are contributing members of the open source and free software communities. I checked. Their contributions are made under a dfsg-compliant license.
Re-reading this again. Still annoyed with the MS hate. There are a lot of good things about the company, and I wish that the criticisms were more constructive.
It’s easier to type c#, but you’re right. I do type the sharp character when I can. No sharp symbol on this keyboard.
I’m just being paranoid about MS and corporations in general….
Like… why did they have to call it “The F# Software Foundation” … doesn’t it seem to be EXTREMELY close (FSF = F# Software Foundation) vs (FSF = Free Software Foundation) …. a bit too close for comfort … I just hope that stick to decency and don’t let the nature of corporate greed rob the world of what could be a great thing.