aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2014-02-10 03:35:19 +0000
committerTimothy Gu <timothygu99@gmail.com>2014-02-10 03:35:19 +0000
commit043b3358a91a5e9bef707fd3720f60552e0b9569 (patch)
tree327f38c90d1505e2b8afd98c55e1b1129c81972e
parentf1642131d79a4854164c47ca8abb4821aa74682c (diff)
downloaddlfcn-win32-043b3358a91a5e9bef707fd3720f60552e0b9569.tar.gz
dlfcn-win32-043b3358a91a5e9bef707fd3720f60552e0b9569.tar.bz2
dlfcn-win32-043b3358a91a5e9bef707fd3720f60552e0b9569.zip
test: add forgotten test
"Open library again (without closing it first) with RTLD_GLOBAL"
-rw-r--r--test.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/test.c b/test.c
index 8977fbc..b8f6c9e 100644
--- a/test.c
+++ b/test.c
@@ -49,7 +49,6 @@
49 * - Get symbol from library through library object <- works 49 * - Get symbol from library through library object <- works
50 * - Run function if it worked 50 * - Run function if it worked
51 * - Get symbol from library through global object <- fails 51 * - Get symbol from library through global object <- fails
52 * - Run function if it worked
53 * - Open library again (without closing it first) with RTLD_GLOBAL 52 * - Open library again (without closing it first) with RTLD_GLOBAL
54 * - Get symbol from library through global object <- works 53 * - Get symbol from library through global object <- works
55 * - Close library 54 * - Close library
@@ -167,6 +166,33 @@ int main()
167 else 166 else
168 printf( "SUCCESS\tDid not get local symbol from global handle.\n" ); 167 printf( "SUCCESS\tDid not get local symbol from global handle.\n" );
169 168
169 library = dlopen( "testdll.dll", RTLD_GLOBAL );
170 if( !library )
171 {
172 error = dlerror( );
173 printf( "ERROR\tCould not open library globally without closing it first: %s\n", error ? error : "" );
174 CLOSE_LIB;
175 CLOSE_GLOBAL;
176 RETURN_ERROR;
177 }
178 else
179 printf( "SUCCESS\tOpened library globally without closing it first: %p\n", library );
180
181 function = dlsym( global, "function" );
182 if( !function )
183 {
184 error = dlerror( );
185 printf( "ERROR\tCould not get symbol from global handle: %s\n",
186 error ? error : "" );
187 CLOSE_LIB;
188 CLOSE_GLOBAL;
189 RETURN_ERROR;
190 }
191 else
192 printf( "SUCCESS\tGot symbol from global handle: %p\n", function );
193
194 RUNFUNC;
195
170 ret = dlclose( library ); 196 ret = dlclose( library );
171 if( ret ) 197 if( ret )
172 { 198 {