#include <ldsyms.h> #include <sys/loader.h> const struct section *getsectbynamefromheader(struct mach_header *mhp, char *segname, char *sectname) const struct section *getsectbyname(char *segname, char *sectname); void *getsectdatafromheader(struct mach_header *mhp, char *segname, char *sectname, int *size) void *getsectdata(char *segname, char *sectname, int *size); void *getsectdatafromlib(char *libname, char *segname, char *sectname, int *size)
Getsectbyname is the same as getsectbynamefromheader with its first argument being the link editor defined symbol _mh_execute_header.
Getsectdatafromheader returns a pointer to the data for the named section in the named segment if it exists in the Mach-O executable for the specified Mach header it is linked into. Also it returns the size of the section data indirectly through the pointer size. Otherwise it returns NULL for the pointer and zero for the size.
Getsectdata is the same as getsectdatafromheader with its first argument being the link editor defined symbol _mh_execute_header.
Getsectdatafromlib is the same as getsectdatafromheader with its first argument being the name of a shared library (for example: ``libNeXT_s'' for /usr/shlib/libNeXT_s.A.shlib) to get the section data from. If that shared library isn't used in the executable then it returns NULL for the pointer and zero for the size.