OWL and GCC
Before MFC there was OWL. OWL is the Object Windows Library originally
created by Borland. Since they still own the code all updates are done
as patches so you will need a copy of the OWL source version 5 or higher. There
are three ways to compile OWL 6.1 with GCC. The two main ways are to use
either the MinGW or Cygwin port of GCC. The only reason to choose Cygwin
over MinGW is if you prefer the UNIX environment that it emulates. The
third way is to compile OWL on Linux, since I don't currently have Linux I can
only offer some ideas.
OWL setup
Compiling with MinGW
Compiling with Cygwin
Compiling on Linux
Portability tips
Setting up OWL
Everything you need to update your copy of OWL is available at the OWLNext
site. You will need the appropriate 6.04 patch, the latest major patch
currently 6.1, and the extra files for Linux.
- Update to version 6.04, I suggest you keep this version in a safe place
as all major updates tend to be applied to this version.
- Update to the latest major version, currently 6.10.
- Extract the extra files, I recommend putting them in the owl/include
directory assuming your patched files went into the owl directory.
- Remember to define _OWLPCH and BI_SUPPRESS_OLE in all
projects that use OWL.
- You will also need a resource compiler. The makefiles are set
up for rc.exe from the Microsoft platform SDK.
MinGW
MinGW is a native port of the GNU compiler suite to Win32. The following
steps should allow you to compile OWL.
- Get a working MinGW installation.
- Update OWL.
- Review and edit owl/source/owlcore/gnumake .
- run gnuowl.bat
- Remember to define _OWLPCH and BI_SUPPRESS_OLE in all
projects that use OWL.
Cygwin
Cygwin is a UNIX porting layer for Win32. The following steps should
allow you to compile OWL.
- Get a working Cygwin installation.
- Get MinGW version of libstdc++.a.
The best place to put this is in owl/lib so that it won't interfere with
the Cygwin version.
- Update OWL.
- Review and edit owl/source/owlcore/gnumake .
Since it required several changes I'm working on a cygmake makefile.
- make -f gnumakefile
- Remember to define _OWLPCH and BI_SUPPRESS_OLE and set
-mno-cygwin in all projects that use OWL.
Linux
I'm not certain that OWL will work or even compile under Linux.
- Get and update OWL.
- Get a working installation of a windows emulator such as WINE.
- Hack the gnumake makefile.
Tips on portable code
- Passing the address of a temporary is not good. ie. you shouldn't do
this:foo(&TRect()). The reason is that the lifetime of the temporary
will vary from compiler to compiler. The temporary can be destroyed any
time from before the function call to after the function returns.
- Passing a non const reference to a temporary is illegal (at least in
GCC). ie.
void foo(class&);
foo(class());.
- A function pointer can't be implicitly converted to a void*. This must
be done explicitly.