source: zzuf/trunk/src/lib-load.h @ 2562

Last change on this file since 2562 was 2562, checked in by Sam Hocevar, 15 years ago
  • Better check for the func keyword that does not rely on assumptions about the compiler version.
  • Property svn:keywords set to Id
File size: 981 bytes
RevLine 
[1470]1/*
2 *  zzuf - general purpose fuzzer
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: lib-load.h 2562 2008-07-18 09:28:02Z sam $
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15/*
[1701]16 *  lib-load.h: preload library functions
[1470]17 */
18
[1687]19/* Symbol loading stuff */
[1494]20#define STR(x) #x
21#define ORIG(x) x##_orig
[1470]22
[1695]23#ifdef HAVE_DLFCN_H
24#   include <dlfcn.h>
[1701]25#   define NEW(x) x
[1695]26#   define LOADSYM(x) \
27        do { \
28            if(!ORIG(x)) \
29                ORIG(x) = dlsym(RTLD_NEXT, STR(x)); \
30            if(!ORIG(x)) \
31                abort(); \
32        } while(0)
33#else
[1701]34#   define NEW(x) x##_new
[1695]35#   define LOADSYM(x) \
36        do { \
[1701]37            /* Nothing to do */ \
[1695]38        } while(0)
39#endif
[1494]40
Note: See TracBrowser for help on using the repository browser.