source: Daodan/MinGW/include/dlfcn.h@ 1143

Last change on this file since 1143 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 3.5 KB
Line 
1/*
2 * dlfcn.h
3 *
4 * Public interface declarations for (approximately) POSIX conforming
5 * dlopen(), dlsym(), dlclose(), and dlerror() API functions.
6 *
7 * $Id: dlfcn.h,v 82d2db93e4de 2014/11/11 18:13:14 keithmarshall $
8 *
9 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
10 * Copyright (C) 2014, MinGW.org Project
11 *
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice, this permission notice, and the following
21 * disclaimer shall be included in all copies or substantial portions of
22 * the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
30 * DEALINGS IN THE SOFTWARE.
31 *
32 */
33#ifndef _DLFCN_H
34#define _DLFCN_H 1
35#pragma GCC system_header
36
37#include <_mingw.h>
38
39/* POSIX requires the following four definitions. Our implementation
40 * (currently) does not support the behaviour associated with RTLD_LAZY;
41 * if specified, it is simply ignored; RTLD_NOW behaviour will prevail.
42 */
43#define RTLD_NOW 0
44#define RTLD_LAZY 1
45#define RTLD_GLOBAL 2
46#define RTLD_LOCAL 4
47
48/* POSIX does not yet require the following pair, but reserves them for
49 * future capabilities; they will be used in contexts where a DLL module
50 * handle is expected, so we reserve values of suitable type, which are
51 * unlikely to ever occur as real module handles in practice.
52 */
53#define RTLD_DEFAULT (void *)(-1)
54#define RTLD_NEXT (void *)(-3)
55
56/* The four dlfcn API functions, dlopen(), dlsym(), dlerror(), and dlclose(),
57 * are each defined privately, and made publicly accessible via corresponding
58 * function pointers, within the following publicly visible structure.
59 */
60_EXTERN_C struct __dlfcn__
61{ void *(*dlopen)( const char *, int );
62 void *(*dlsym)( void *__restrict__, const char *__restrict__ );
63 char *(*dlerror)( void );
64 int (*dlclose)( void * );
65} __mingw_dlfcn;
66
67/* Declare the public API for each of these functions...
68 */
69_BEGIN_C_DECLS
70
71/* In any event, we always declare prototypes for all four functions.
72 */
73void * dlopen( const char *, int );
74void * dlsym( void *__restrict__, const char *__restrict__ );
75int dlclose( void * );
76char * dlerror( void );
77
78__CRT_ALIAS __LIBIMPL__(( FUNCTION = dlopen ))
79void *dlopen( const char *__name, int __mode )
80{ return __mingw_dlfcn.dlopen( __name, __mode ); }
81
82__CRT_ALIAS __LIBIMPL__(( FUNCTION = dlsym ))
83void *dlsym( void *__restrict__ __module, const char *__restrict__ __name )
84{ return __mingw_dlfcn.dlsym( __module, __name ); }
85
86__CRT_ALIAS __LIBIMPL__(( FUNCTION = dlclose ))
87int dlclose( void *__module ){ return __mingw_dlfcn.dlclose( __module ); }
88
89__CRT_ALIAS __LIBIMPL__(( FUNCTION = dlerror ))
90char *dlerror( void ){ return __mingw_dlfcn.dlerror(); }
91
92_END_C_DECLS
93
94#endif /* _DLFCN_H: $RCSfile: dlfcn.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.