<HTML ><HEAD ><TITLE >ELF File Sections</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK REL="HOME" TITLE="ELFIO" HREF="index.php"><LINK REL="UP" TITLE="Getting Started With ELFIO" HREF="c18.htm"><LINK REL="PREVIOUS" TITLE="Getting Started With ELFIO" HREF="c18.htm"><LINK REL="NEXT" TITLE="Section Readers" HREF="x45.htm"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >ELFIO: Tutorial</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="c18.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 1. Getting Started With ELFIO</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x45.htm" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN35" >ELF File Sections</A ></H1 > <P > ELF binary files consist of several sections. Each section has it's own responsibility: some contain executable code; others describe program dependencies; others symbol tables and so on. See the TIS documentation for a full description of each section. </P > <P > To see how many sections the ELF file contains, including their names and sizes, is demonstated in the following code: <PRE CLASS="PROGRAMLISTING" > int nSecNo = pReader->GetSectionsNum(); for ( int i = 0; i < nSecNo; ++i ) { // For all sections const IELFISection* pSec = pReader->GetSection( i ); std::cout << pSec->GetName() << '' '' << pSec->GetSize() << std::endl; pSec->Release(); }</PRE > </P > <P > First, the number of sections are received; next, a pointer on the <FONT COLOR="RED" >IELFISection</FONT > interface. Using this interface, access is gained to the different section attributes: size, type, flags and address. To get a buffer that contains the section's bytes use the <TT CLASS="METHODNAME" >GetData()</TT > member function of this interface. See the <FONT COLOR="RED" >IELFISection</FONT > declaration for a full description of the <FONT COLOR="RED" >IELFISection</FONT > interface. </P > </DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="c18.htm" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.php" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x45.htm" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Getting Started With ELFIO</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c18.htm" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Section Readers</TD ></TR ></TABLE ></DIV ></BODY ></HTML >