Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 259293 Details for
Bug 351113
>=sys-devel/gcc-4.5 - g++ creates unloadable libraries
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Executable source code (see in the file for compile command)
test_dlopen.c (text/plain), 1.57 KB, created by
Andreas Fink
on 2011-01-08 12:59:29 UTC
(
hide
)
Description:
Executable source code (see in the file for compile command)
Filename:
MIME Type:
Creator:
Andreas Fink
Created:
2011-01-08 12:59:29 UTC
Size:
1.57 KB
patch
obsolete
>// g++ -ldl -o test_dlopen test_dlopen.c && ./test_dlopen ./libtest.so > >#include <dlfcn.h> >#include <link.h> >#include <cstdio> >#include <iostream> > >int cb(struct dl_phdr_info* info, size_t size, void* data) >{ > std::cout << info->dlpi_name << std::endl; > return 0; >} > >typedef void (*test_fct)(); > >int main(int argc, char** argv) >{ > const char* szLibPath = "./libtest.so"; > if ( argc > 1 ) { > szLibPath = argv[1]; > } > > // dlopen the library and list all loaded libraries in memory > void* pLibHandle = dlopen(szLibPath, RTLD_LAZY|RTLD_GLOBAL); > std::cout << "-----------------------------------------------------------------------------------" << std::endl; > std::cout << "Loaded libraries, after " << szLibPath << " has been loaded" << std::endl; > dl_iterate_phdr(cb, 0); > > // dlclose the library and list again all closed libraries > std::cout << "-----------------------------------------------------------------------------------" << std::endl; > std::cout << "dlclose(pLibHandle) return value: " << dlclose(pLibHandle) << " (should return 0)" << std::endl; // should return 0 > std::cout << "Loaded libraries after " << szLibPath << " has been closed..." << std::endl; > dl_iterate_phdr(cb, 0); > > // the bug is here really visible, since a second dlcolse(pLibHandle) returns 0 although the library has been closed already > std::cout << "-----------------------------------------------------------------------------------" << std::endl; > std::cout << "dlclose(pLibHandle) return value: " << dlclose(pLibHandle) << " (should return -1)" << std::endl; // should return -1 > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 351113
:
259291
| 259293 |
259522