aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/test.c b/test.c
index 878694e..e7124ae 100644
--- a/test.c
+++ b/test.c
@@ -41,7 +41,6 @@
41 RETURN_ERROR; \ 41 RETURN_ERROR; \
42 } \ 42 } \
43 } while( 0 ) 43 } while( 0 )
44
45 44
46/* This is what this test does: 45/* This is what this test does:
47 * - Open library with RTLD_GLOBAL 46 * - Open library with RTLD_GLOBAL
@@ -74,7 +73,7 @@ int main()
74 void *library; 73 void *library;
75 char *error; 74 char *error;
76 int (*function)( void ); 75 int (*function)( void );
77 int (*printf_local)( const char * ); 76 size_t (*fwrite_local) ( const void *, size_t, size_t, FILE * );
78 int (*nonexistentfunction)( void ); 77 int (*nonexistentfunction)( void );
79 int ret; 78 int ret;
80 79
@@ -108,8 +107,8 @@ int main()
108 else 107 else
109 printf( "SUCCESS\tGot global handle: %p\n", global ); 108 printf( "SUCCESS\tGot global handle: %p\n", global );
110 109
111 printf_local = dlsym(global, "printf"); 110 fwrite_local = dlsym(global, "fwrite");
112 if (!printf_local) 111 if (!fwrite_local)
113 { 112 {
114 error = dlerror(); 113 error = dlerror();
115 printf("ERROR\tCould not get symbol from global handle: %s\n", 114 printf("ERROR\tCould not get symbol from global handle: %s\n",
@@ -119,8 +118,10 @@ int main()
119 RETURN_ERROR; 118 RETURN_ERROR;
120 } 119 }
121 else 120 else
122 printf("SUCCESS\tGot symbol from global handle: %p\n", printf_local); 121 printf("SUCCESS\tGot symbol from global handle: %p\n", fwrite_local);
123 printf_local("Hello world from local printf!\n"); 122 char * hello_world = "Hello world from local fwrite!\n";
123 fwrite_local(hello_world,sizeof(char),strlen(hello_world),stderr);
124 fflush(stderr);
124 125
125 function = dlsym( library, "function" ); 126 function = dlsym( library, "function" );
126 if( !function ) 127 if( !function )
@@ -304,7 +305,7 @@ int main()
304 error ? error : "" ); 305 error ? error : "" );
305 } 306 }
306 307
307 function = dlsym(global, "printf"); 308 function = dlsym(global, "fwrite");
308 if (!function) 309 if (!function)
309 { 310 {
310 error = dlerror(); 311 error = dlerror();
@@ -316,6 +317,7 @@ int main()
316 } 317 }
317 else 318 else
318 printf("SUCCESS\tGot symbol from global handle: %p\n", function); 319 printf("SUCCESS\tGot symbol from global handle: %p\n", function);
320
319 321
320 ret = dlclose( library ); 322 ret = dlclose( library );
321 if( ret ) 323 if( ret )