1.\" $NetBSD: dlfcn.3,v 1.30 2010/12/24 13:00:24 wiz Exp $ 2.\" 3.\" Copyright (c) 1998 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Paul Kranenburg. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd April 28, 2011 31.Dt DLFCN 3 32.Os 33.Sh NAME 34.Nm dlopen , 35.Nm dlclose , 36.Nm dlinfo , 37.Nm dladdr , 38.Nm dlsym , 39.Nm dlfunc , 40.Nm dlvsym , 41.Nm dl_iterate_phdr , 42.Nm dlerror 43.Nd programmatic interface to the dynamic linker 44.Sh LIBRARY 45This function is not in a library. 46It is included in every dynamically linked program automatically. 47.Sh SYNOPSIS 48.In dlfcn.h 49.Ft "void *" 50.Fn dlopen "const char *name" "int mode" 51.Ft int 52.Fn dlclose "void *handle" 53.Ft int 54.Fn dlinfo "void *handle" "int request" "void *p" 55.Ft int 56.Fn dladdr "const void *addr" "Dl_info *info" 57.Ft "void *" 58.Fn dlsym "void *handle" "const char *name" 59.Ft dlfunc_t 60.Fn dlfunc "void *handle" "const char *name" 61.Ft "void *" 62.Fn dlvsym "void *handle" "const char *name" "const char *version" 63.Ft "char *" 64.Fn dlerror "void" 65.In link.h 66.Ft "int" 67.Fn dl_iterate_phdr "int (*callback)(struct dl_phdr_info *, size_t, void *)" "void * data" 68.Sh DESCRIPTION 69These functions provide an interface to the run-time linker 70.Xr ld-elf.so.2 1 . 71They allow new shared objects to be loaded into the process' address space 72under program control. 73.Sh SEE ALSO 74.Xr ld 1 , 75.Xr rtld 1 , 76.Xr dladdr 3 , 77.Xr dlclose 3 , 78.Xr dlerror 3 , 79.Xr dlfunc 3 , 80.Xr dlinfo 3 , 81.Xr dl_iterate_phdr 3 , 82.Xr dlopen 3 , 83.Xr dlsym 3 , 84.Xr dlvsym 3 , 85.Xr link 5 86.Sh HISTORY 87Some of the 88.Nm dl* 89functions first appeared in SunOS 4. 90