This repository has been archived by the owner on May 4, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unix: it's legal for dlsym() to return NULL
A symbol name can map to NULL. Check dlerror() to see if a real error happened.
- Loading branch information
1 parent
e9235a3
commit feb267e
Showing
2 changed files
with
10 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
feb267e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purely out of interest. Do you know how to create a symbol so that dlsym() returns NULL when you try to resolve it?
feb267e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on your toolchain. With gcc, you compile with
-Wl,--defsym=foo=0x0
or-Wl,--just-symbols=symbols.txt
(where symbols.txt contains one or moresymbol = address
mappings).feb267e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Though I can't imagine why anyone would use foo=0x0 in a real linux application or library.
feb267e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's sometimes used by application plugins to signal that they're compatible with a particular API version but don't support all the functions.