1.1 --- a/epoc32/include/stdapis/dlfcn.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/dlfcn.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,127 @@
1.4 -dlfcn.h
1.5 +/*-
1.6 + * Portions Copyright (c) 2006 Nokia Corporation
1.7 + * All Rights Reserved.
1.8 + *
1.9 + * Copyright (c) 1994
1.10 + * The Regents of the University of California. All rights reserved.
1.11 + *
1.12 + * Redistribution and use in source and binary forms, with or without
1.13 + * modification, are permitted provided that the following conditions
1.14 + * are met:
1.15 + * 1. Redistributions of source code must retain the above copyright
1.16 + * notice, this list of conditions and the following disclaimer.
1.17 + * 2. Redistributions in binary form must reproduce the above copyright
1.18 + * notice, this list of conditions and the following disclaimer in the
1.19 + * documentation and/or other materials provided with the distribution.
1.20 + * 4. Neither the name of the University nor the names of its contributors
1.21 + * may be used to endorse or promote products derived from this software
1.22 + * without specific prior written permission.
1.23 + *
1.24 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.25 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.26 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.27 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.28 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.29 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.30 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.31 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.32 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.33 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.34 + * SUCH DAMAGE.
1.35 + *
1.36 + * $FreeBSD: src/include/dlfcn.h,v 1.19 2003/02/13 17:47:43 kan Exp $
1.37 + */
1.38 +
1.39 +#ifndef _DLFCN_H_
1.40 +#define _DLFCN_H_
1.41 +
1.42 +#include <sys/_types.h>
1.43 +
1.44 +/*
1.45 + * Modes and flags for dlopen().
1.46 + */
1.47 +#define RTLD_LAZY 1 /* Bind function calls lazily. */
1.48 +#define RTLD_NOW 2 /* Bind function calls immediately. */
1.49 +#define RTLD_MODEMASK 0x3
1.50 +#define RTLD_GLOBAL 0x100 /* Make symbols globally available. */
1.51 +#define RTLD_LOCAL 0 /* Opposite of RTLD_GLOBAL, and the default. */
1.52 +#define RTLD_TRACE 0x200 /* Trace loaded objects and exit. */
1.53 +
1.54 +/*
1.55 + * Request arguments for dlinfo().
1.56 + */
1.57 +#define RTLD_DI_LINKMAP 2 /* Obtain link map. */
1.58 +#define RTLD_DI_SERINFO 4 /* Obtain search path info. */
1.59 +#define RTLD_DI_SERINFOSIZE 5 /* ... query for required space. */
1.60 +#define RTLD_DI_ORIGIN 6 /* Obtain object origin */
1.61 +#define RTLD_DI_MAX RTLD_DI_ORIGIN
1.62 +
1.63 +/*
1.64 + * Special handle arguments for dlsym()/dlinfo().
1.65 + */
1.66 +#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
1.67 +#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
1.68 +#define RTLD_SELF ((void *) -3) /* Search the caller itself. */
1.69 +
1.70 +#if __BSD_VISIBLE
1.71 +
1.72 +#ifndef _SIZE_T_DECLARED
1.73 +typedef __size_t size_t;
1.74 +#define _SIZE_T_DECLARED
1.75 +#endif
1.76 +
1.77 +/*
1.78 + * Structure filled in by dladdr().
1.79 + */
1.80 +typedef struct dl_info {
1.81 + const char *dli_fname; /* Pathname of shared object. */
1.82 + void *dli_fbase; /* Base address of shared object. */
1.83 + const char *dli_sname; /* Name of nearest symbol. */
1.84 + void *dli_saddr; /* Address of nearest symbol. */
1.85 +} Dl_info;
1.86 +
1.87 +/*-
1.88 + * The actual type declared by this typedef is immaterial, provided that
1.89 + * it is a function pointer. Its purpose is to provide a return type for
1.90 + * dlfunc() which can be cast to a function pointer type without depending
1.91 + * on behavior undefined by the C standard, which might trigger a compiler
1.92 + * diagnostic. We intentionally declare a unique type signature to force
1.93 + * a diagnostic should the application not cast the return value of dlfunc()
1.94 + * appropriately.
1.95 + */
1.96 +struct __dlfunc_arg {
1.97 + int __dlfunc_dummy;
1.98 +};
1.99 +
1.100 +typedef void (*dlfunc_t)(struct __dlfunc_arg);
1.101 +
1.102 +/*
1.103 + * Structures, returned by the RTLD_DI_SERINFO dlinfo() request.
1.104 + */
1.105 +typedef struct dl_serpath {
1.106 + char * dls_name; /* single search path entry */
1.107 + unsigned int dls_flags; /* path information */
1.108 +} Dl_serpath;
1.109 +
1.110 +typedef struct dl_serinfo {
1.111 + size_t dls_size; /* total buffer size */
1.112 + unsigned int dls_cnt; /* number of path entries */
1.113 + Dl_serpath dls_serpath[1]; /* there may be more than one */
1.114 +} Dl_serinfo;
1.115 +
1.116 +#endif /* __BSD_VISIBLE */
1.117 +
1.118 +__BEGIN_DECLS
1.119 +/* XSI functions first. */
1.120 +
1.121 +IMPORT_C void *dlopen(const char *filename, int flag);
1.122 +
1.123 +IMPORT_C void *dlsym(void *handle, const char *symbol);
1.124 +
1.125 +IMPORT_C char *dlerror(void);
1.126 +
1.127 +IMPORT_C int dlclose(void *handle);
1.128 +
1.129 +__END_DECLS
1.130 +
1.131 +#endif /* !_DLFCN_H_ */