On Fri, 29 May 2015 14:05:10 -0400, Jacob Carlborg <d...@me.com> wrote:
On 2015-05-29 18:45, bitwise wrote:
I'm going to test it out this weekend, but if I do get the wrong
address, I think I can add a symbol with "__attribute__ ((visibility
("hidden")))" and use dladdr on that instead. I don't think hidden
symbols should collide.
Doesn't "dlopen" open the current image if "null" is passed?
No, it opens the image for the main program, even if called from a shared
lib.
And that void* which is returned is actually a "mach_header*", if I
recall correctly.
Not sure if this is true.
This works for sure in terms of getting "a" mach_header*, but I still have
to check if visibility(hidden) allows each shared lib to have it's own
copy of "_symbol":
__attribute__ ((visibility("hidden"))) static int _symbol = 1;
Dl_info info;
if(dladdr(&symbol, &info))
const struct mach_header* myHeader = cast(const struct
mach_header*)info.dli_fbase
https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dladdr.3.html
Bit