Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Mar 1999 20:45:24 -0600 (CST)
From:      Steve Price <sprice@hiwaay.net>
To:        freebsd-hackers@freebsd.org
Subject:   dladdr(3) question
Message-ID:  <Pine.OSF.4.02.9903232035020.150-100000@fly.HiWAAY.net>

next in thread | raw e-mail | index | archive | help
Hi All,

I know I'm probably doing something stupid here, but I
seem to be having a problem getting dladdr(3) to work.
Here's the code ...

#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
int foo() {
	return 0;
}
int main() {
	Dl_info dlinfo;
	if (dladdr(foo, &dlinfo) == 0) {
		printf("dladdr failed: %s\n", dlerror());
		exit(1);
	}
	printf("dli_fname = %s\n", dlinfo.dli_fname);
	return 0;
}

... and a couple of sample runs.

bsd[~]$ ./a.out
dladdr failed: Service unavailable
bsd[~]$ uname -rs
FreeBSD 4.0-CURRENT

pepito[~]$ ./a.out
dli_fname = a.out
pepito[~]$ uname -rs
SunOS 5.7

Anyone have any ideas where I'm missing the boat?

-steve



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.4.02.9903232035020.150-100000>