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

Last change on this file since 4253 was 4253, checked in by sam, 5 years ago

Fix copyright information and remove Id tag everywhere.

  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1/*
2 *  zzuf - general purpose fuzzer
3 *  Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
4 *                All Rights Reserved
5 *
6 *  This program is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12
13/*
14 *  lib-load.h: preload library functions
15 */
16
17/* Symbol loading stuff */
18#define STR(x) #x
19#define ORIG(x) x##_orig
20
21#ifdef HAVE_DLFCN_H
22#   include <dlfcn.h>
23#   define NEW(x) x
24#   define LOADSYM(x) \
25        do { \
26            if(!ORIG(x)) \
27            { \
28                /* XXX: we try to initialise libzzuf as soon as possible, \
29                 * otherwise we may miss a lot of stuff if we wait for \
30                 * the linker to load us fully. */ \
31                _zz_init(); \
32                ORIG(x) = dlsym(RTLD_NEXT, STR(x)); \
33            } \
34            if(!ORIG(x)) \
35                abort(); \
36        } while(0)
37#else
38#   define NEW(x) x##_new
39#   define LOADSYM(x) \
40        do { \
41            /* Nothing to do under Windows, everything is done as soon \
42             * as the process is launched. */ \
43        } while(0)
44#endif
45
Note: See TracBrowser for help on using the repository browser.