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
|
Line | |
---|
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 | /* |
---|
16 | * lib-load.h: preload library functions |
---|
17 | */ |
---|
18 | |
---|
19 | /* Symbol loading stuff */ |
---|
20 | #define STR(x) #x |
---|
21 | #define ORIG(x) x##_orig |
---|
22 | |
---|
23 | #ifdef HAVE_DLFCN_H |
---|
24 | # include <dlfcn.h> |
---|
25 | # define NEW(x) x |
---|
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 |
---|
34 | # define NEW(x) x##_new |
---|
35 | # define LOADSYM(x) \ |
---|
36 | do { \ |
---|
37 | /* Nothing to do */ \ |
---|
38 | } while(0) |
---|
39 | #endif |
---|
40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.