1.\" This source code is a product of Sun Microsystems, Inc. and is provided 2.\" for unrestricted use provided that this legend is included on all tape 3.\" media and as a part of the software program in whole or part. Users 4.\" may copy or modify this source code without charge, but are not authorized 5.\" to license or distribute it to anyone else except as part of a product or 6.\" program developed by the user. 7.\" 8.\" THIS PROGRAM CONTAINS SOURCE CODE COPYRIGHTED BY SUN MICROSYSTEMS, INC. 9.\" SUN MICROSYSTEMS, INC., MAKES NO REPRESENTATIONS ABOUT THE SUITABLITY 10.\" OF SUCH SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT 11.\" EXPRESS OR IMPLIED WARRANTY OF ANY KIND. SUN MICROSYSTEMS, INC. DISCLAIMS 12.\" ALL WARRANTIES WITH REGARD TO SUCH SOURCE CODE, INCLUDING ALL IMPLIED 13.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN 14.\" NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT, 15.\" INCIDENTAL, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 16.\" FROM USE OF SUCH SOURCE CODE, REGARDLESS OF THE THEORY OF LIABILITY. 17.\" 18.\" This source code is provided with no support and without any obligation on 19.\" the part of Sun Microsystems, Inc. to assist in its use, correction, 20.\" modification or enhancement. 21.\" 22.\" SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 23.\" INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS 24.\" SOURCE CODE OR ANY PART THEREOF. 25.\" 26.\" Sun Microsystems, Inc. 27.\" 2550 Garcia Avenue 28.\" Mountain View, California 94043 29.\" 30.\" Copyright (c) 1991 Sun Microsystems, Inc. 31.\" 32.\" $FreeBSD: release/8.1.0/lib/libc/gen/dlopen.3 205979 2010-03-31 13:51:31Z gahr $ 33.\" 34.Dd April 29, 2011 35.Dt DLCLOSE 3 36.Os 37.Sh NAME 38.Nm dlclose 39.Nd unlink shared object from process address space 40.Sh LIBRARY 41This function is not in a library. 42It is included in every dynamically linked program automatically. 43.Sh SYNOPSIS 44.In dlfcn.h 45.Ft int 46.Fn dlclose "void *handle" 47.Sh DESCRIPTION 48The 49.Fn dlclose 50function 51deletes a reference to the shared object referenced by 52.Fa handle . 53If the reference count drops to 0, the object is removed from the 54address space, and 55.Fa handle 56is rendered invalid. 57Just before removing a shared object in this way, the dynamic linker 58calls the object's 59.Fn _fini 60function, if such a function is defined by the object. 61.Pp 62The object-intrinsic functions 63.Fn _init 64and 65.Fn _fini 66are called with no arguments, and are not expected to return values. 67.Sh RETURN VALUES 68The 69.Fn dlclose 70function 71returns 0 on success, or -1 if an error occurred. 72Whenever an error has been detected, a message detailing it can be 73retrieved via a call to 74.Fn dlerror . 75.Sh SEE ALSO 76.Xr rtld 1 , 77.Xr dlerror 3 , 78.Xr dlfcn 3 , 79.Xr dlopen 3 80