remde@npdiss1.StPaul.NCR.COM (Kevin Remde) (03/12/91)
Hello, I've recently been given the task of researching the ins and outs of porting C code from UNIX to OS/2 platforms. I was wondering where I might find books or other resources that might help me in this task. Even better - are there any tools available (whether commercial or otherwise) which will allow easy porting from UNIX to OS/2; like maybe a library of UNIX-like functions for OS/2 development? Any and all help will be greatly appreciated. ______________________________________________________________________________ Kevin A. Remde remde@ncrons.StPaul.NCR.COM NCR Network Products Division (612)638-7376
rad@genco.bungi.com (Bob Daniel) (03/19/91)
In article <907@npdiss1.StPaul.NCR.COM> remde@npdiss1.StPaul.NCR.COM (Kevin Remde) writes: >I've recently been given the task of researching the ins and outs of >porting C code from UNIX to OS/2 platforms. I was wondering where I >might find books or other resources that might help me in this task. I have not ported a UNIX app to OS/2 but have done it to Macintosh. The key issue is the compiler you use. I was using a compiler that contained all the UNIX libraries (and ANSI C). It was Think C. This biggest issue that came up was forking processes. It was however relatively easy to deal with. Just modify it to run under the same process. I've ported some small apps to Mac with almost no modifications. I would think the same can be done to OS/2 with a decent compiler. I have not seen any books on porting code but if you are familiar with UNIX and OS/2 programming, it isn't as difficult a task as it may seem. (Unless you have a compiler w/out UNIX libs.)
dboles@ccwf.cc.utexas.edu (David Boles) (03/22/91)
Just having a compiler that has UNIX libs is only a very meager beginning. Much code for UNIX boxes has the implicit assumption in it that the size of a pointer is the same as the size of an int, 32 bits. Removing this dependence is a monumental task. The "small UNIX app" that was ported to the Mac using "we Think it's C" must have been small indeed to have not run into the pervasive bugs in the libraries. -- ------------------------------------------------------------------------------- David Boles Applied Research Laboratories dboles@ccwf.cc.utexas.edu DOS is severely brain-damaged, apas611@chpc.utexas.edu so just pull the plug and let it DIE. -------------------------------------------------------------------------------
rommel@Informatik.TU-Muenchen.DE (Kai-Uwe Rommel) (03/22/91)
In article <583@genco.bungi.com> rad@genco.bungi.com (Bob Daniel) writes: >In article <907@npdiss1.StPaul.NCR.COM> remde@npdiss1.StPaul.NCR.COM (Kevin Remde) writes: >>I've recently been given the task of researching the ins and outs of >>porting C code from UNIX to OS/2 platforms. I was wondering where I >>might find books or other resources that might help me in this task. > >I have not ported a UNIX app to OS/2 but have done it to Macintosh. The key >issue is the compiler you use. I was using a compiler that contained all the >UNIX libraries (and ANSI C). It was Think C. This biggest issue that came >up was forking processes. It was however relatively easy to deal with. Just >modify it to run under the same process. During porting several programs to OS/2 I found two main problems. 1. Many Unix programs rely on Unix-specific library routines that are not supported even by the very Unix-compatible Microsoft C compiler, most notably the POSIX directory access routines (opendir/readir/ closedir) and regular expression routines and getopt. I had to collect or write/modify such routines. Once I had them, porting was much easier. 2. Many today's Unix programs assume a 32bit machine with sizeof(int) = sizeof(long) = sizeof(any pointer) = 32bits. This is not easy to solve. (Anyone still asking why GNU emacs is not yet available for OS/2 :-) Kai Uwe Rommel
alex@am.sublink.org (Alex Martelli) (03/23/91)
rommel@Informatik.TU-Muenchen.DE (Kai-Uwe Rommel) writes:
...
:1. Many Unix programs rely on Unix-specific library routines that are
: not supported even by the very Unix-compatible Microsoft C compiler,
: most notably the POSIX directory access routines (opendir/readir/
: closedir) and regular expression routines and getopt. I had to
: collect or write/modify such routines. Once I had them, porting was
I disagree with the characterization of Microsoft C as "very Unix
compatible"; I find it quite lacking, particularly in the library.
Watcom C 8.0 is better, for example it DOES have opendir/readdir.
But more in general, you are right. Fortunately, "Unix-specific"
library routines ARE becoming easier and easier to find, both built
in to compilers' libraries and in such places as the freed BSD sources
and various freely redistributable programs around the net...
--
Alex Martelli - (home snailmail:) v. Barontini 27, 40138 Bologna, ITALIA
Email: (work:) martelli@cadlab.sublink.org, (home:) alex@am.sublink.org
Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434;
Fax: ++39 (51) 366964 (work only), Fidonet: 332/401.3 (home only).