Subject: Re: dlopen()'s second argument and Undefined PLT symbol (was: libdl
To: Jeremy C. Reed <reed@reedmedia.net>
From: Todd Vierling <tv@wasabisystems.com>
List: netbsd-help
Date: 02/28/2001 13:11:54
On Wed, 28 Feb 2001, Jeremy C. Reed wrote:

: The DLFCN(3) manual page says that dlopen()'s second argument "has
: currently no effect, but should be set to DL_LAZY for future
: compatibility."

Actually, that's not completely true anymore; the manpage should be fixed.
We support several RTLD_* flags now.

:         handle = dlopen(plugin_file, RTLD_NOW);

: The handle is always NULL.

This is not because of RTLD_NOW; DL_LAZY just delayed the problem till later
(see below).

: So it appears that the second argument does matter. (Also, where
: are these /usr/include/dlfcn.h definitions explained?)

We need to update the manpage; if you'd like, submit a PR on it.  The
dlopen() man page *should* contain the RTLD_* constants, but doesn't yet.

: Now to figure out my next problem:
:  /usr/local/lib/ao/liboss.so: Undefined PLT symbol "_oss_ioctl" (reloc
:  type = 7, symnum = 13)

This means that you haven't linked liboss.so against libossaudio.so (found
in /usr/lib).  On NetBSD, OSS is a compatibility system found in a library,
which contains _oss_ioctl (a function that intercepts ioctl() calls).  So,
when linking your liboss.so, you need to do something like this:

cc -shared -o liboss.so ... -lossaudio

That will add the necessary shared library dependency, and your liboss.so
will load into memory properly.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi NetBSD:  Run with it.
-- NetBSD 1.5 now available on CD-ROM  --  http://www.wasabisystems.com/