Last change
on this file since 1701 was
1701,
checked in by Sam Hocevar, 16 years ago
|
- Added DLL initialisation code for Win32.
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
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 1701 2007-01-23 15:38:18Z 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 | /* The __func__ macro to get the current function name */ |
---|
20 | #if __STDC_VERSION__ < 199901L |
---|
21 | # if __GNUC__ >= 2 |
---|
22 | # define __func__ __FUNCTION__ |
---|
23 | # else |
---|
24 | # define __func__ "<?>" |
---|
25 | # endif |
---|
26 | #endif |
---|
27 | |
---|
28 | /* Symbol loading stuff */ |
---|
29 | #define STR(x) #x |
---|
30 | #define ORIG(x) x##_orig |
---|
31 | |
---|
32 | #ifdef HAVE_DLFCN_H |
---|
33 | # include <dlfcn.h> |
---|
34 | # define NEW(x) x |
---|
35 | # define LOADSYM(x) \ |
---|
36 | do { \ |
---|
37 | if(!ORIG(x)) \ |
---|
38 | ORIG(x) = dlsym(RTLD_NEXT, STR(x)); \ |
---|
39 | if(!ORIG(x)) \ |
---|
40 | abort(); \ |
---|
41 | } while(0) |
---|
42 | #else |
---|
43 | # define NEW(x) x##_new |
---|
44 | # define LOADSYM(x) \ |
---|
45 | do { \ |
---|
46 | /* Nothing to do */ \ |
---|
47 | } while(0) |
---|
48 | #endif |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.