[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog support/dynlib.c
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog support/dynlib.c |
Date: |
Thu, 10 May 2007 18:28:59 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 07/05/10 18:28:59
Modified files:
. : ChangeLog
support : dynlib.c
Log message:
Fix resolving symbols in shared libraries on FreeBSD.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3453&r2=1.3454
http://cvs.savannah.gnu.org/viewcvs/pnet/support/dynlib.c?cvsroot=dotgnu-pnet&r1=1.13&r2=1.14
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3453
retrieving revision 1.3454
diff -u -b -r1.3453 -r1.3454
--- ChangeLog 5 May 2007 17:35:41 -0000 1.3453
+++ ChangeLog 10 May 2007 18:28:58 -0000 1.3454
@@ -1,3 +1,10 @@
+2007-05-10 Klaus Treichel <address@hidden>
+
+ * support/dynlib.c: Fix ILDynLibraryGetSymbol for FreeBSD. Resolving a
+ symbol semed to fail because a previous error was not cleared by calling
+ dlerror prior to calling dlsym (Thanks to Steffen Reichelt for finding
this
+ issue and pointing out how to solve it).
+
2007-05-05 Klaus Treichel <address@hidden>
* support/intern.c, include/il_utils.h: Make the interned string a const
Index: support/dynlib.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/dynlib.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- support/dynlib.c 27 Oct 2004 09:05:17 -0000 1.13
+++ support/dynlib.c 10 May 2007 18:28:58 -0000 1.14
@@ -379,14 +379,24 @@
void *ILDynLibraryGetSymbol(void *handle, const char *symbol)
{
- void *value = dlsym(handle, (char *)symbol);
+ /* call dlerror prior to resolving the symbol to clear any pending
+ errors. */
const char *error = dlerror();
- char *newName;
- if(error == 0)
+ void *value = dlsym(handle, (char *)symbol);
+ if(value != 0)
{
+ /* In this case we definitely found the symbol. */
return value;
}
- newName = (char *)ILMalloc(strlen(symbol) + 2);
+ if(!(error = dlerror()))
+ {
+ /* No error. The symbol is actually NULL */
+ return 0;
+ }
+ else
+ {
+ /* There occured an error during resolving the symbol */
+ char *newName = (char *)ILMalloc(strlen(symbol) + 2);
if(newName)
{
/* Try again with '_' prepended to the name in case
@@ -394,14 +404,22 @@
newName[0] = '_';
strcpy(newName + 1, symbol);
value = dlsym(handle, newName);
+ if(value != 0)
+ {
+ /* So we found the symbol with preceding
underscore. */
+ ILFree(newName);
+ return value;
+ }
error = dlerror();
if(error == 0)
{
+ /* This symbol is NULL. */
ILFree(newName);
return value;
}
ILFree(newName);
}
+ }
#ifdef IL_DYNLIB_DEBUG
fprintf(stderr, "%s: %s\n", symbol, error);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog support/dynlib.c,
Klaus Treichel <=