assert.h problems with shared libraries

From: Henning Meier-Geinitz (henning@meier-geinitz.de)
Date: Thu May 31 2001 - 13:42:14 PDT

  • Next message: ANTONISHEN Robert -CIO PROJ DEL: "Xsane .\config errors"

    Hi,

    I think I have found out why shared libraries don't work with gcc on
    AIX. I don't know if that happens on other platforms too, but this
    problem seems to be quite usual as I found lots of website that
    mention it.

    In assert.h, assert is a macro and contains a call to __eprintf.
    __eprintf is in libgcc.a. So it's unresolved in the SANE backend
    libraries because assert is used in sanei_scsi.c and some backends.

    I tried some workarounds but nothing really worked.

    E.g. Defining assert in config.h: #define assert(arg) ;
    Doesn't work, because assert.h is loaded after config.h

    Defining NDEBUG works, but I don't want to disable debugging for
    everything.

    Some options: Don't use assert. Or use a local header file (lassert.h)
    which checks for AIX and uses it's own assert if necessary. Or use a
    #ifdef HAVE_ASSERT for every assert.

    Any good ideas?

    Bye,
      Henning

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Thu May 31 2001 - 13:45:44 PDT