Subject: Re: dlopen() related compiler warning
To: None <dolecek@ics.muni.cz>
From: Ty Sarna <tsarna@endicor.com>
List: current-users
Date: 01/11/1998 13:05:15
In article <199801111615.RAA28463@saruman.ics.muni.cz> you write:
> So - is that NetBSD hack really mandatory or is it a misunderstanding ?
> For NetBSD 1.3 I'm using now it's definitely not needed; but for

I have a Python 1.5 package (PR#4764, files at
ftp://ftp.endicor.com/pub/netbsd/python/tar.gz)
I'm still waiting for it to be comitted to pkgsrc.

I didn't need any patches at all for 1.3. The only patch in my package
is the "re.1" patch from www.python.org.

However, looking into it now, I see at least a couple things that could
use changing. First is the comment "NetBSD shared libraries (not quite
SVR4 compatible)". I'm not sure exactly what this is in reference to,
(dlerror?) but it seems odd. Next is that NetBSD does have dlerror() in
1.3, so the #define of that should be removed for 1.3 and later.

You can test for this by comparing against the symbol NetBSD from
<sys/param.h>.  1.3 is 199712. (This assumes dlerror() was introduced
between 1.2 and 1.3, which I think is correct).

The following is a quick and dirty patch that works on 1.3 (modulo a
warning: MAXPATHLEN is redefined between python's osdef.h and
sys/param.h) and that _should_ work on earlier versions since it
preserves the old behavior in the pre-1.3 case.

--- importdl.c.orig	Sun Jan 11 12:53:01 1998
+++ importdl.c	Sun Jan 11 12:54:01 1998
@@ -53,7 +53,7 @@
    SHORT_EXT	-- short extension for dynamic module, e.g. ".so"
    LONG_EXT	-- long extension, e.g. "module.so"
    hpux		-- HP-UX Dynamic Linking - defined by the compiler
-   __NetBSD__	-- NetBSD shared libraries (not quite SVR4 compatible)
+   __NetBSD__	-- NetBSD shared libraries
    __FreeBSD__	-- FreeBSD shared libraries
 
    (The other WITH_* symbols are used only once, to set the
@@ -88,7 +88,11 @@
 #define LONG_EXT ".dll"
 #endif
 
-#if defined(__NetBSD__)
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#if defined(__NetBSD__) && (NetBSD < 199712)
 #define DYNAMIC_LINK
 #define USE_SHLIB
 
@@ -157,7 +161,7 @@
 #ifdef USE_SHLIB
 #include <sys/types.h>
 #include <sys/stat.h>
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) && (NetBSD < 199712)
 #include <nlist.h>
 #include <link.h>
 #else