TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Tom Williams
from: Rob Landley
date: 1995-08-09 19:20:46
subject: EMX/G++

> Thanks again for the info.  Sounds good.  Is the G++ compiler pretty good? 
> How does it compare to commercial compilers liek C Set ++?

Well, I use cset++ every day at work, and to tell you the truth I prefer
EMX.  (Which is the OS/2 version of GCC I use.  The EMX package contains
GCC, G++, the libraries and header files, and a unix emulator.  These are
contained in the files GNUDEV.ZIP, GPPDEV.ZIP, EMXDEV.ZIP, and EMXRT.ZIP
respectively.

The unix emulator confuses people, but you need it to run the package.  You
see, GCC was developed under unix, and rather than go to a lot of work
porting it they just use a .dll that emulates unix.  (foreward slashes for
filenames, pipes and files using the same I/O functions, unix signal
conventions, etc.)

You can use EMX to compile 32 bit native OS/2 programs (presentation
manager and everything.  If you have the developer's toolkit, you can even
use SOM.)  You can also use EMX to port other unix programs to OS/2 (and
use the unix emulation .dll with your own programs.)  It's very nice.

To compile a native OS/2 program, you give the compiler the command line
arguments -Zomf -Zsys.  The first tells it to make .obj style object files
instead of unix style .o files.  The second tells it to link with the OS/2
system call library instead of the EMX unix emulation library (which
requires the .dll to run.)

I wrote a utility called "bake" which simplifies all this.  It's
available from ftp.cdrom.com in the directory pub/os2/incoming as
bakev100.zip.

Bake works like this:  The first line of the file is the name of the
program you want to compile.  (file.exe, file.dll, file.lib are self
explanatory.  file.emx compiles an .exe for unix emulation, and .em2 is a
hybrid between unix emulation and OS/2 native.  Faster than .emx, but not
quite as compatible with unix.  Still requires the .dll, though.)

Anyway, all the rest of the lines name a source file.  So the following is
a sample "bakefile".

filename.exe
source.cc
source2.cc
another.obj
linkwith.lib
stuff.def
resource.rc

and then you go "bake bakefile" and it'll compile everything that
needs compiling, link with everything that needs linking, and produce your
file.

There are some OS/2 programming things you need to learn, like the fact
that whenever you create a .dll file you need a .def file as one of the
source files, but if you're just making text mode .exe files then all you
need are normal C source files (and any non-default libraries you want to
link with.)

Rob
 
--- Xblat
* Origin: The conversation pit, OS/2 in Boca Raton, FL (1:3638/42)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 515 628 704 713/888 800/1 7877/2809
@PATH: 3638/42 14 3615/50 396/1 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.