Re: need advice on library interface
* Glenn Maynard (g_deb@zewt.org) wrote:
> On Tue, Aug 06, 2002 at 11:54:50AM -0500, Joshua Haberman wrote:
> > This caused a problem for me when I tried to link against wxWindows,
> > which *also* includes off_t in its interface but *doesn't* compile with
> > _FILE_OFFSET_BITS=64.
>
> Instead of using _FILE_OFFSET_BITS, define _GNU_SOURCE (or _LARGEFILE64_SOURCE)
> to get off64_t and the 64-bit set of functions, and use those instead. (You'd
> need to make a layer for systems without LFS support, though. Aliasing
> off64_t -> off_t, fstat64 -> fstat, etc. with typedefs and #defines should
> work.)
I don't see how this addresses the problem. I need a way to ensure a
consistent ABI while supporting LFS and maintaining maximum portability
(think HP-UX, Amiga, QNX, and vendor compilers).
Also consider the case of a system that doesn't support LFS, but adds it
in the future. This must not cause ABI breakage.
> Standard types that change based on configuration #defines are a pain;
> if a library requires _FILE_OFFSET_BITS to match the setting in
> applications, it'll cause problems if an application actually wants it
> to be left alone for some reason.
It is more than just a pain: it is a violation of the ABI. It also makes
it impossible to mix libraries in some cases (like the
libsndfile/wxWindows case that I mentioned).
Josh
--
Joshua Haberman <joshua@haberman.com>
Reply to: