Skip site navigation (1)Skip section navigation (2)
Date:      20 Mar 2002 07:57:09 +0200
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Joseph Argiro <joeargiro@yahoo.com>
Cc:        ports@FreeBSD.org
Subject:   Re:
Message-ID:  <1016603534.95975.10.camel@notebook>
In-Reply-To: <000801c1cf8a$20804c00$0300a8c0@mdltwn1.nj.home.com>
References:  <000801c1cf8a$20804c00$0300a8c0@mdltwn1.nj.home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2002-03-19 at 23:07, Joseph Argiro wrote:
> is there an api  for run time linking of libraries and/or .o files
> if so can you direct me to the functions 
> an example would be even better

man dlopen
man dlsym

short example:

typedef int (*func_t)(char *, int);

void handle;
func_t func;

handle = dlopen("/usr/local/lib/libfoo.so", RTLD_LAZY);
if (handle == NULL)
	errx(1, "%s", dlerror());
func = (func_t)dlsym(handle, "foofunction");
if (func == NULL)
	errx(1, "%s", dlerror());
func("bar", 1000);
dlclose(handle);

-Maxim



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1016603534.95975.10.camel>