ensuring all object files are compiled with -fexceptions

xorquewasp at googlemail.com xorquewasp at googlemail.com
Fri Jan 16 20:01:16 EST 2009


Hello.

I'm working with some code that needs to raise exceptions inside
callbacks passed to PHYSFS_enumerateFilesCallback().

The usual way to do this (as with all other C libraries I'm using
in this manner) is to compile the PhysFS library with the
-fexceptions compiler flag.

Failing to do this with any library results in any exception raised
inside a callback calling abort() immediately instead of unwinding
the call stack as expected.

I'm using the following, to compile PhysFS:

  #!/bin/sh

  export CC="gcc43"
  export LD="gcc43"

  # clean cmake cache
  for file in `hg status | grep -v BUILD.sh | awk '{print $2}'`
  do
    echo remove $file
    rm -f $file
  done

  cmake \
    -DCMAKE_C_FLAGS="-g -fexceptions" \
    -DCMAKE_INSTALL_PREFIX="${HOME}"

  make

However, I'm still seeing the behaviour mentioned above, with exceptions
failing to unwind the call stack and I have to assume that the values
given in $CMAKE_C_FLAGS aren't being applied to all (or any) object
files.

Not being familiar with cmake, what's the correct way to force all
objects to be compiled with these flags?

thanks,
xw



More information about the physfs mailing list