From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 9 14:36:21 2004 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 EC96F16A4CE for ; Thu, 9 Sep 2004 14:36:21 +0000 (GMT) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF77943D4C for ; Thu, 9 Sep 2004 14:36:21 +0000 (GMT) (envelope-from mux@freebsd.org) Received: by elvis.mu.org (Postfix, from userid 1920) id B52695CA68; Thu, 9 Sep 2004 07:36:21 -0700 (PDT) Date: Thu, 9 Sep 2004 16:36:21 +0200 From: Maxime Henrion To: db Message-ID: <20040909143621.GD13294@elvis.mu.org> References: <200409091630.36721.db@traceroute.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200409091630.36721.db@traceroute.dk> User-Agent: Mutt/1.4.2.1i cc: hackers@freebsd.org Subject: Re: Runtime loading 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: Thu, 09 Sep 2004 14:36:22 -0000 db wrote: > Hi all > > In my C++ program I need to load some files/classes at runtime, so that users > can add "plugins" without recompilling my program. What functions should I > use? I'm using FreeBSD 5.3-beta2 btw. I'm not sure about C++, though I guess you could use the same functions as in C. If that's true, then you should use the dlopen() family of functions. They are quite portable, since you'll find the same functions under all the *BSD, Linux and Solaris. Be aware that with Linux and Solaris, those functions are located in libdl, while they are found in libc on the *BSD systems. Cheers, Maxime