[LLVMdev] [PATCH] Get dlerror() messages
Julien Lerouge
jlerouge at apple.com
Tue Mar 11 17:09:53 PDT 2008
Hello,
Attached is a simple fix for getting error messages from dlerror in
LoadLibraryPermanently. The current code modifies the value of a pointer
that is passed by value, so the caller never gets the message.
Hope this helps,
Julien
--
Julien Lerouge
PGP Key Id: 0xB1964A62
PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62
PGP Public Key from: keyserver.pgp.com
-------------- next part --------------
Index: lib/System/DynamicLibrary.cpp
===================================================================
--- lib/System/DynamicLibrary.cpp (revision 48244)
+++ lib/System/DynamicLibrary.cpp (working copy)
@@ -63,7 +63,8 @@
std::string *ErrMsg) {
void *H = dlopen(Filename, RTLD_LAZY);
if (H == 0) {
- ErrMsg = new std::string(dlerror());
+ if (ErrMsg)
+ *ErrMsg = dlerror();
return true;
}
OpenedHandles.push_back(H);
More information about the llvm-dev
mailing list