C Hello World and Windows tool chain

Mike C. Fletcher mcfletch at vrplumber.com
Mon Apr 2 13:28:57 EDT 2007


sbspammagnet at aol.com wrote:
> Hi Everyone,
>  
> We are about to start a porting a large C project to the OLPC and have 
> a couple of questions that we can't find the answer to in the wiki or 
> archives. Before we start to reinvent the wheel, does anyone have the 
> answers to the following:
>  
> 1) Is there an complete (preferably graphical/windowed) OLPC 'Hello 
> World' example written in C anywhere?
There is not, to my knowledge, an OLPC-specific GTK-in-C Hello World.  
However, if you look for a general GTK2 example, such as you can see 
here (this is just from a quick search on Google code):

http://www.google.com/codesearch?hl=en&q=show:KB5tbamdhMo:dLwsXYQFifY&sa=N&ct=rdl&cs_p=http://ftp.iasi.roedu.net/mirrors/ftp.gimp.org/gtk/v2.0/gtk%2B-2.0.3.tar.bz2&cs_f=gtk%2B-2.0.3/examples

those should help you with how to port to GTK2.  Most likely you'll want 
to port your application to GTK2 using the Win32 port, then do the 
(comparatively minor) changes to work with OLPC using a Linux system 
(possibly in emulation on a Win32 system).

> 2) We use a Windows XP based build farm to compile and build 
> our projects for all the platforms we target. We want to build our 
> OLPC port on the same build farm (i.e. we don't want to have to build 
> our projects on Linux). Does anyone have documentation/executables/etc 
> (presumably cygwin based) for some or all of a tool chain that builds 
> OLPC applications written in C on Windows?
Again, not to my knowledge for a Win32-based tool chain, though I 
believe there is at least one cross-compiler based on GCC that has been 
used to produce OLPC binary extensions from a regular Linux system.  In 
theory the same type of cross-compilation should work on Win32 with 
enough of the environment set up, but I'd expect you'll have better luck 
just installing a Linux machine somewhere and building on that (or 
having someone else do it) when you want to do the OLPC binary distribution.

My suggestion would be to concentrate on a GTK2 (Linux) port, then worry 
about the OLPC port.  You're going to find far more documentation and 
tools for porting to GTK2/Linux than for the OLPC system (which focuses 
on interpreted languages for the most part).  If you simply keep in mind 
the OLPC restrictions (such as having a single root window, not 
necessarily having a regular file system view) you should be able to do 
the much of the porting work on Win32.  Since GTK2 runs on Windows you 
can continue to work in your environment for the bulk of the porting 
work, though you'll likely need to run a Linux machine for the final 
operations.  Emulation can make that reasonably painless for your 
developers.

You'll probably want to look into the Glade UI designer if you are 
accustomed to Win32-style UI design, btw.  You might also consider 
whether you can expose your functionality as libraries and then use one 
of the interpreted languages to create the UI using the exposed 
functionality.  That would let you use HippoCanvas (a wrapper around the 
GTK2 (regular GUI) and Cairo (high quality canvas) libraries) to 
integrate fully with the platform's look-and-feel, but we are just 
getting the documentation efforts under way for that.

BTW, my focus is on interpreted language development, so it could be I'm 
missing some obvious path for C developers, but hopefully this is 
somewhat helpful.

Take care,
Mike

-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com




More information about the Devel mailing list