Remove remaining host.conf(5) traces.
[dragonfly.git] / lib / libc / gen / dlfunc.c
blobb628de66e4545e9a1fe4b55653e264572e830ee9
1 /*
2 * This source file is in the public domain.
3 * Garrett A. Wollman, 2002-05-28.
5 * $FreeBSD: src/lib/libc/gen/dlfunc.c,v 1.3 2002/09/11 05:05:48 mike Exp $
6 */
8 #include <dlfcn.h>
11 * Implement the dlfunc() interface, which behaves exactly the same as
12 * dlsym() except that it returns a function pointer instead of a data
13 * pointer. This can be used by applications to avoid compiler warnings
14 * about undefined behavior, and is intended as prior art for future
15 * POSIX standardization. This function requires that all pointer types
16 * have the same representation, which is true on all platforms FreeBSD
17 * runs on, but is not guaranteed by the C standard.
19 dlfunc_t
20 dlfunc(void * __restrict handle, const char * __restrict symbol)
22 union {
23 void *d;
24 dlfunc_t f;
25 } rv;
27 rv.d = dlsym(handle, symbol);
28 return (rv.f);