Modifications to compile 4.0 with MinGW

We have been working at LBNL to compile Radiance 4.0 for inclusion in
WINDOW6 (win32).
We managed to compile it, based on Francesco's MinGW instructions, but
here are a few small code issues we need to resolve.

The gcc compiler complains while compiling mkillum.exe
it reports that the 'quit' function is defined both in
/src/rt/raypwin.c and /src/gen/mkillum.c
We commented out the 'quit' function in raypwin.c and were able to
compile, but there are cleaner solutions. Any suggestions on how to do
solve this?

As others reported before, we also found the issue with the call to
timegm in /src/common/header.c

Here is out proposed change:
change this:
tms.tm_year -= 1900;
*tloc = timegm(&tms);

to this:
tms.tm_year -= 1900;
#ifdef _WIN32
*tloc = time(&tms);
#else
*tloc = timegm(&tms);
#endif

We also made some changes to the Scons scripts, but I will send those
in a separate e-mail, since it is not a direct source code issue.

Christian

···

**************
Christian Kohler, [email protected], (510) 486-5040, http://windows.lbl.gov ,
Windows & Daylighting Research Group, Lawrence Berkeley National Laboratory
1 Cyclotron Rd, Berkeley, California, 94720, USA

Hi Christian,

I really appreciate your efforts on this. I took out the redundant definition of quit() in raypwin.c -- this should have been removed earlier. I will check this in along with the other changes needed to the SCONS system.

As for the timegm() -> time() substitution, are you sure these calls have the same semantics? It seems to be a direct conflict with the standard POSIX call, which returns the current time. Very different from timegm(), which converts calendar times to seconds elapsed since the epoch. Can you point me to an online API somewhere?

Thanks!
-Greg

···

From: Christian Kohler <[email protected]>
Date: May 21, 2010 5:09:30 PM PDT

We have been working at LBNL to compile Radiance 4.0 for inclusion in
WINDOW6 (win32).
We managed to compile it, based on Francesco's MinGW instructions, but
here are a few small code issues we need to resolve.

The gcc compiler complains while compiling mkillum.exe
it reports that the 'quit' function is defined both in
/src/rt/raypwin.c and /src/gen/mkillum.c
We commented out the 'quit' function in raypwin.c and were able to
compile, but there are cleaner solutions. Any suggestions on how to do
solve this?

As others reported before, we also found the issue with the call to
timegm in /src/common/header.c

Here is out proposed change:
change this:
tms.tm_year -= 1900;
*tloc = timegm(&tms);

to this:
tms.tm_year -= 1900;
#ifdef _WIN32
*tloc = time(&tms);
#else
*tloc = timegm(&tms);
#endif

We also made some changes to the Scons scripts, but I will send those
in a separate e-mail, since it is not a direct source code issue.

Christian