dlfcn.h revision 90172
1238384Sjkim/* 2238384Sjkim * Copyright (c) 1994 3238384Sjkim * The Regents of the University of California. All rights reserved. 4238384Sjkim * 5238384Sjkim * Redistribution and use in source and binary forms, with or without 6238384Sjkim * modification, are permitted provided that the following conditions 7238384Sjkim * are met: 8238384Sjkim * 1. Redistributions of source code must retain the above copyright 9238384Sjkim * notice, this list of conditions and the following disclaimer. 10238384Sjkim * 2. Redistributions in binary form must reproduce the above copyright 11238384Sjkim * notice, this list of conditions and the following disclaimer in the 12238384Sjkim * documentation and/or other materials provided with the distribution. 13238384Sjkim * 3. All advertising materials mentioning features or use of this software 14238384Sjkim * must display the following acknowledgement: 15238384Sjkim * This product includes software developed by the University of 16238384Sjkim * California, Berkeley and its contributors. 17238384Sjkim * 4. Neither the name of the University nor the names of its contributors 18238384Sjkim * may be used to endorse or promote products derived from this software 19238384Sjkim * without specific prior written permission. 20238384Sjkim * 21238384Sjkim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22238384Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23238384Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24238384Sjkim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25238384Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26238384Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27238384Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28238384Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29238384Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30238384Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31238384Sjkim * SUCH DAMAGE. 32238384Sjkim * 33238384Sjkim * $FreeBSD: head/include/dlfcn.h 90172 2002-02-04 10:33:48Z sobomax $ 34238384Sjkim */ 35238384Sjkim 36238384Sjkim#ifndef _DLFCN_H_ 37238384Sjkim#define _DLFCN_H_ 38238384Sjkim#include <sys/cdefs.h> 39238384Sjkim 40238384Sjkim/* 41238384Sjkim * Modes and flags for dlopen(). 42 */ 43#define RTLD_LAZY 1 /* Bind function calls lazily */ 44#define RTLD_NOW 2 /* Bind function calls immediately */ 45#define RTLD_MODEMASK 0x3 46#define RTLD_GLOBAL 0x100 /* Make symbols globally available */ 47#define RTLD_LOCAL 0 /* Opposite of RTLD_GLOBAL, and the default */ 48#define RTLD_TRACE 0x200 /* Trace loaded objects and exit */ 49 50/* 51 * Special handle arguments for dlsym(). 52 */ 53#define RTLD_NEXT ((void *) -1) /* Search subsequent objects */ 54#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm */ 55 56/* 57 * Structure filled in by dladdr(). 58 */ 59typedef struct dl_info { 60 const char *dli_fname; /* Pathname of shared object */ 61 void *dli_fbase; /* Base address of shared object */ 62 const char *dli_sname; /* Name of nearest symbol */ 63 void *dli_saddr; /* Address of nearest symbol */ 64} Dl_info; 65 66__BEGIN_DECLS 67int dladdr __P((const void *, Dl_info *)); 68int dlclose __P((void *)); 69const char *dlerror __P((void)); 70void dllockinit __P((void *_context, 71 void *(*_lock_create)(void *_context), 72 void (*_rlock_acquire)(void *_lock), 73 void (*_wlock_acquire)(void *_lock), 74 void (*_lock_release)(void *_lock), 75 void (*_lock_destroy)(void *_lock), 76 void (*_context_destroy)(void *_context))); 77void *dlopen __P((const char *, int)); 78void *dlsym __P((void *, const char *)); 79__END_DECLS 80 81#endif /* !_DLFCN_H_ */ 82