openbsd-ports/www/konqueror-embedded/patches/patch-konq-embed_dropin_klibloader_cpp
2003-08-06 15:45:55 +00:00

44 lines
1.1 KiB
Plaintext

$OpenBSD: patch-konq-embed_dropin_klibloader_cpp,v 1.6 2003/08/06 15:45:55 brad Exp $
--- konq-embed/dropin/klibloader.cpp.orig Thu Jun 12 15:03:24 2003
+++ konq-embed/dropin/klibloader.cpp Sat Jul 5 15:12:20 2003
@@ -27,6 +27,8 @@
#include "kglobal.h"
#include <kstddirs.h>
+#include <stdlib.h>
+#include <string.h>
#include <assert.h>
#if defined(HAVE_DLFCN)
@@ -96,7 +98,19 @@ KDLOpenLibrary::~KDLOpenLibrary()
void *KDLOpenLibrary::symbol( const char *name )
{
- return dlsym( m_handle, name );
+ void *res = dlsym( m_handle, name );
+#ifdef __OpenBSD__
+ if ( !res ) {
+ char *name2 = (char *)malloc(strlen(name)+2);
+ if (name2) {
+ name2[0] = '_';
+ strcpy(name2+1, name);
+ res = dlsym( m_handle, name2);
+ free(name2);
+ }
+ }
+#endif
+ return res;
}
#endif
@@ -152,6 +166,9 @@ KLibrary *KLibLoader::library( const cha
KLibrary *KLibLoader::globalLibrary( const char *name )
{
+#ifndef RTLD_GLOBAL
+# define RTLD_GLOBAL 0
+#endif
#if defined(HAVE_DLFCN)
void *handle = dlopen( name, RTLD_LAZY | RTLD_GLOBAL );
if ( !handle )