[Courses] porting programs

Shuying swan936 at cse.unsw.EDU.AU
Sun Apr 7 17:35:12 EST 2002


Jen, please just reply to the mailing list so I just get one copy instead
of two. :)

On Sat, 6 Apr 2002, jennyw wrote:

> On Sun, Apr 07, 2002 at 01:41:30PM +1000, Shuying wrote:
> > On 6 Apr 2002, Beth Johnson wrote:
> > > of theme elements.  I'm also interested in how programs are ported from
> > > one OS to another.
> >
> > I haven't ported very many programs (actually 1), but my understanding is
> > that you simply change the bits of code that rely on a particular OS. For
> > example, if you're porting a linux program to windows say, you're likely
> > to make use of some win32 library. And then sometimes you've to do some
> > really dirty hack because what works on one OS doesn't work on the other.
> > :) Hope that answers your question.
>
> I don't know if "simply change ..." is the best way to phrase it ;-).

Yeah I guess that isn't the best way to put it. It depends on how portable
the code is to start with. :)

> But, yeah, you end up using different libraries, etc. Then of course an
> int on one system might have a different number of bits than an int on

And usually you'd try not to write code that assumes the size of an int or
any other types for the matter, right?

> And ... there can be a lot involved, which is why some stuff doesn't get
> ported.

Yeah, especially hacks that make a lot of assumption about the system. Or
if the program makes heavy use of compiler/system specific features. Like
porting a X windows gui to MS windows would require more work than porting
one using GTK.

> Of course, it all depends on the language you're using. If you were

I think in general, the more abstracted the language is away from the
machine, the easier it is to port? I think assembly is pretty much machine
instructions, so it is not so much a matter of porting across OSes but
more of porting across architectures. Like the MIPS instruction set would be
pretty much different from a m68k or intel one. Correct me if I'm wrong,
since I've never tried porting any code written in assembly from linux to
windows. :)

--Shuying





More information about the Courses mailing list