Skip to content
Snippets Groups Projects
Commit 6f7d49c1 authored by Alessandro Di Federico's avatar Alessandro Di Federico
Browse files

Test dlsym with non-function symbol

parent 2efc6c3a
No related branches found
No related tags found
No related merge requests found
......@@ -13,8 +13,7 @@ the previously loaded shared objects are searched in load order.
* Import sys/queue.h
* Add support for having different address spaces
* Test dlsym with non-function symbols
* Call fini function
* Add support for TLS relocations
* Let eld_init and eld_finish be called from crt
* Documentation
\ No newline at end of file
* Documentation
int your_variable = 0xbea7;
int your() {
return 99;
}
......@@ -22,7 +22,11 @@ int main() {
typedef int (*myfunc_ptr)();
myfunc_ptr myfunc = NULL;
myfunc = dlsym(NULL, "my");
printf("%d\n", myfunc());
int *libyour_variable = dlsym(NULL, "your_variable");
printf("myfunc() == %d\n", myfunc());
printf("your_variable == 0x%x\n", *libyour_variable);
// Close the loaded libraries
RETURN_ON_ERROR(dlclose(libmy_handle));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment