getsectbyname.3   [plain text]


.TH GETSECTBYNAME 3  "April 10, 1998" "Apple Computer, Inc."
.SH NAME
getsectbyname, getsectdata \- get the section information for the named section
.SH SYNOPSIS
.nf
\fB#include <mach-o/getsect.h>\fR
.PP
const struct section *\fBgetsectbynamefromheader\fR(
const struct mach_header *\fImhp\fR,
const char *\fIsegname\fR,
const char *\fIsectname\fR)
.sp .5
const struct section *\fBgetsectbyname\fR(
const char *\fIsegname\fR,
const char *\fIsectname\fR)
.sp .5
char *\fBgetsectdatafromheader\fR(
const struct mach_header *\fImhp\fR,
const char *\fIsegname\fR,
const char *\fIsectname\fR,
unsigned long *\fIsize\fR)
.sp .5
char *\fBgetsectdata\fR(
const char *\fIsegname\fR,
const char *\fIsectname\fR,
unsigned long *\fIsize\fR)
.sp .5
char *\fBgetsectdatafromFramework\fR(
const char *\fIFrameworkName\fR,
const char *\fIsegname\fR,
const char *\fIsectname\fR,
unsigned long *\fIsize\fR)
.fi
.SH DESCRIPTION
.I Getsectbynamefromheader
returns the section structure for the named section in the named segment if it
exists in the specified Mach header otherwise it returns
.SM NULL.
If the specified Mach header comes from a dynamic library as returned by
.IR _dyld_get_image_header (3)
the
.I addr
field in the section structure will have to have
.IR _dyld_get_image_vmaddr_slide (3)
added to it to make it a valid pointer.
.PP
.I Getsectbyname
is the same as 
.I getsectbynamefromheader
with its first argument being the link editor defined symbol
.I _mh_execute_header.
.PP
.I Getsectdatafromheader
returns the address to the data for the named section in the named segment if
it exists in the specified Mach header.  Also it returns the size of the section
data indirectly through the pointer size.
Otherwise it returns
.SM NULL
for the pointer and zero for the size.
If the specified Mach header comes from a dynamic library as returned by
.IR _dyld_get_image_header (3)
the address to the data returned will have to have
.IR _dyld_get_image_vmaddr_slide (3)
added to it to make it a valid pointer.
.PP
.I Getsectdata
is the same as 
.I getsectdatafromheader
with its first argument being the link editor defined symbol
.I _mh_execute_header.
.PP
.I getsectdatafromFramework
is used to get the named section data from the named Framework.
For example, the framework name ``Appkit'' would be used
for /System/Library/Frameworks/Appkit.framework/Versions/C/Appkit.
If that Framework isn't being used by the program then it
returns
.SM NULL
for the pointer and zero for the size.
.SH "SEE ALSO"
dyld(3), getsegbyname(3)