From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 3 02:17:05 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F339016A4CE for ; Wed, 3 Dec 2003 02:17:04 -0800 (PST) Received: from oasis.uptsoft.com (oasis.uptsoft.com [217.20.165.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF7C443F3F for ; Wed, 3 Dec 2003 02:17:01 -0800 (PST) (envelope-from devnull@oasis.uptsoft.com) Received: (from devnull@localhost) by oasis.uptsoft.com (8.11.6/linuxconf) id hB3AGxU00944 for freebsd-hackers@freebsd.org; Wed, 3 Dec 2003 12:16:59 +0200 Date: Wed, 3 Dec 2003 12:16:59 +0200 From: Sergey Lyubka To: freebsd-hackers@freebsd.org Message-ID: <20031203121658.A822@oasis.uptsoft.com> Mail-Followup-To: freebsd-hackers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-OS: FreeBSD 4.5-STABLE Subject: dlopen() and -pg flag X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2003 10:17:05 -0000 Below is a little snipper that tries to dlopen(argv[1]). It works fine until it is compiled with profiling support, -pg flag. Compiled with -pg, dlopen() reports "Service unavailable". How to fix that ? -sergey #include #include #include int main(int argc, char *argv[]) { void *handle, *sym; if (argc > 1) { handle = dlopen(argv[1], RTLD_NOW); if (handle == NULL) { fprintf(stderr, "dlopen: %s\n", dlerror()); } else { fprintf(stderr, "handle: %p\n", handle); if (argc > 2) { sym = dlsym(handle, argv[2]); fprintf(stderr, "%s: %p\n", argv[2], sym); } } } return (EXIT_SUCCESS); }