Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Dec 2003 12:16:59 +0200
From:      Sergey Lyubka <devnull@uptsoft.com>
To:        freebsd-hackers@freebsd.org
Subject:   dlopen() and -pg flag
Message-ID:  <20031203121658.A822@oasis.uptsoft.com>

next in thread | raw e-mail | index | archive | help
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 <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>

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);
}



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