2 ms·
dlopen() can be used to call a C function by a string name. More ambitious programmers can scan executable regions of memory for the instruction stream of the
by jws 11y ago
dlopen() can be used to call a C function by a string name.
More ambitious programmers can scan executable regions of memory for the instruction stream of the target function and call the address directly without any help from symbolic names at all.
- conradev 11y agoCorrect. Even easier, they can store a hash of the symbol name and walk the dyld cache until they find a match. No dlsym required. The runtime isn't as straightforward as SourceDNA makes it seem.
- makecheck 11y agoI didn't say the function would be in a dynamic library, although you're right that this would work if it was. A statically-linked function would have to be referenced directly in the executable somewhere.