epoc32/include/stdapis/dlfcn.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*-
williamr@2
     2
 * Portions Copyright (c) 2006 Nokia Corporation
williamr@2
     3
 * All Rights Reserved.
williamr@2
     4
 *
williamr@2
     5
 * Copyright (c) 1994
williamr@2
     6
 *	The Regents of the University of California.  All rights reserved.
williamr@2
     7
 *
williamr@2
     8
 * Redistribution and use in source and binary forms, with or without
williamr@2
     9
 * modification, are permitted provided that the following conditions
williamr@2
    10
 * are met:
williamr@2
    11
 * 1. Redistributions of source code must retain the above copyright
williamr@2
    12
 *    notice, this list of conditions and the following disclaimer.
williamr@2
    13
 * 2. Redistributions in binary form must reproduce the above copyright
williamr@2
    14
 *    notice, this list of conditions and the following disclaimer in the
williamr@2
    15
 *    documentation and/or other materials provided with the distribution.
williamr@2
    16
 * 4. Neither the name of the University nor the names of its contributors
williamr@2
    17
 *    may be used to endorse or promote products derived from this software
williamr@2
    18
 *    without specific prior written permission.
williamr@2
    19
 *
williamr@2
    20
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
williamr@2
    21
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
williamr@2
    22
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
williamr@2
    23
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
williamr@2
    24
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
williamr@2
    25
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
williamr@2
    26
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
williamr@2
    27
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
williamr@2
    28
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
williamr@2
    29
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
williamr@2
    30
 * SUCH DAMAGE.
williamr@2
    31
 *
williamr@2
    32
 * $FreeBSD: src/include/dlfcn.h,v 1.19 2003/02/13 17:47:43 kan Exp $
williamr@2
    33
 */
williamr@2
    34
williamr@2
    35
#ifndef _DLFCN_H_
williamr@2
    36
#define	_DLFCN_H_
williamr@2
    37
williamr@2
    38
#include <sys/_types.h>
williamr@2
    39
williamr@2
    40
/*
williamr@2
    41
 * Modes and flags for dlopen().
williamr@2
    42
 */
williamr@2
    43
#define	RTLD_LAZY	1	/* Bind function calls lazily. */
williamr@2
    44
#define	RTLD_NOW	2	/* Bind function calls immediately. */
williamr@2
    45
#define	RTLD_MODEMASK	0x3
williamr@2
    46
#define	RTLD_GLOBAL	0x100	/* Make symbols globally available. */
williamr@2
    47
#define	RTLD_LOCAL	0	/* Opposite of RTLD_GLOBAL, and the default. */
williamr@2
    48
#define	RTLD_TRACE	0x200	/* Trace loaded objects and exit. */
williamr@2
    49
williamr@2
    50
/*
williamr@2
    51
 * Request arguments for dlinfo().
williamr@2
    52
 */
williamr@2
    53
#define	RTLD_DI_LINKMAP		2	/* Obtain link map. */
williamr@2
    54
#define	RTLD_DI_SERINFO		4	/* Obtain search path info. */
williamr@2
    55
#define	RTLD_DI_SERINFOSIZE	5	/*  ... query for required space. */
williamr@2
    56
#define	RTLD_DI_ORIGIN		6	/* Obtain object origin */
williamr@2
    57
#define	RTLD_DI_MAX		RTLD_DI_ORIGIN
williamr@2
    58
williamr@2
    59
/*
williamr@2
    60
 * Special handle arguments for dlsym()/dlinfo().
williamr@2
    61
 */
williamr@2
    62
#define	RTLD_NEXT	((void *) -1)	/* Search subsequent objects. */
williamr@2
    63
#define	RTLD_DEFAULT	((void *) -2)	/* Use default search algorithm. */
williamr@2
    64
#define	RTLD_SELF	((void *) -3)	/* Search the caller itself. */
williamr@2
    65
williamr@2
    66
#if __BSD_VISIBLE
williamr@2
    67
williamr@2
    68
#ifndef	_SIZE_T_DECLARED
williamr@2
    69
typedef __size_t        size_t;
williamr@2
    70
#define	_SIZE_T_DECLARED
williamr@2
    71
#endif
williamr@2
    72
williamr@2
    73
/*
williamr@2
    74
 * Structure filled in by dladdr().
williamr@2
    75
 */
williamr@2
    76
typedef	struct dl_info {
williamr@2
    77
	const char	*dli_fname;	/* Pathname of shared object. */
williamr@2
    78
	void		*dli_fbase;	/* Base address of shared object. */
williamr@2
    79
	const char	*dli_sname;	/* Name of nearest symbol. */
williamr@2
    80
	void		*dli_saddr;	/* Address of nearest symbol. */
williamr@2
    81
} Dl_info;
williamr@2
    82
williamr@2
    83
/*-
williamr@2
    84
 * The actual type declared by this typedef is immaterial, provided that
williamr@2
    85
 * it is a function pointer.  Its purpose is to provide a return type for
williamr@2
    86
 * dlfunc() which can be cast to a function pointer type without depending
williamr@2
    87
 * on behavior undefined by the C standard, which might trigger a compiler
williamr@2
    88
 * diagnostic.  We intentionally declare a unique type signature to force
williamr@2
    89
 * a diagnostic should the application not cast the return value of dlfunc()
williamr@2
    90
 * appropriately.
williamr@2
    91
 */
williamr@2
    92
struct __dlfunc_arg {
williamr@2
    93
	int	__dlfunc_dummy;
williamr@2
    94
};
williamr@2
    95
williamr@2
    96
typedef	void (*dlfunc_t)(struct __dlfunc_arg);
williamr@2
    97
williamr@2
    98
/*
williamr@2
    99
 * Structures, returned by the RTLD_DI_SERINFO dlinfo() request.
williamr@2
   100
 */
williamr@2
   101
typedef struct dl_serpath {
williamr@2
   102
	char *		dls_name;	/* single search path entry */
williamr@2
   103
	unsigned int	dls_flags;	/* path information */
williamr@2
   104
} Dl_serpath;
williamr@2
   105
williamr@2
   106
typedef struct  dl_serinfo {
williamr@2
   107
        size_t		dls_size;       /* total buffer size */
williamr@2
   108
        unsigned int	dls_cnt;        /* number of path entries */
williamr@2
   109
        Dl_serpath	dls_serpath[1]; /* there may be more than one */
williamr@2
   110
} Dl_serinfo;
williamr@2
   111
williamr@2
   112
#endif /* __BSD_VISIBLE */
williamr@2
   113
williamr@2
   114
__BEGIN_DECLS
williamr@2
   115
/* XSI functions first. */
williamr@2
   116
williamr@2
   117
IMPORT_C void *dlopen(const char *filename, int flag);
williamr@2
   118
williamr@2
   119
IMPORT_C void *dlsym(void *handle, const char *symbol);
williamr@2
   120
williamr@2
   121
IMPORT_C char *dlerror(void);
williamr@2
   122
williamr@2
   123
IMPORT_C int dlclose(void *handle);
williamr@2
   124
williamr@2
   125
__END_DECLS
williamr@2
   126
williamr@2
   127
#endif /* !_DLFCN_H_ */