Getting a mach_header from dlopen
Getting a mach_header from dlopen
- Subject: Getting a mach_header from dlopen
- From: Spencer Nielsen <email@hidden>
- Date: Mon, 2 May 2005 14:34:45 -0700
Does anybody know offhand a good way to get a code image's
mach_header (for use with getsectdatafromheader) of a specific file?
In 10.3 I used the structure that dlopen returned (dlstatus) and it
had a pointer right in there. However, things have changed in 10.4
and dlopen now returns a different structure (dlopen_handle). The
structure returned now contains the NSModule for the file among other
things. I tried running through all the loaded images with
_dyld_get_image_header and comparing the names (using
_dyld_get_image_name) with the NSNameOfModule() called on the
NSModule in the structure returned by dlopen but NSNameOfModule()
always returns nil. I know that depending on what is returned by
dlopen is probably not the best of strategies (perhaps that is why
the man page still documents it as returning void*). All I need to
be able to do it get the mach_header of code images that I am loading
in with dlopen. Thanks!
Spencer Nielsen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden