<HTML ><HEAD ><TITLE >Creation of get_module</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Source Discussion" HREF="zend.structure.html"><LINK REL="PREVIOUS" TITLE="Declaration of the Zend Module Block" HREF="zend.structure.module-block.html"><LINK REL="NEXT" TITLE="Implementation of All Exported Functions" HREF="zend.structure.implementation.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="section" 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" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="zend.structure.module-block.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 31. Source Discussion</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="zend.structure.implementation.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="zend.structure.get-module" ></A >Creation of <B CLASS="function" >get_module()</B ></H1 ><P > This function is special to all dynamic loadable modules. Take a look at the creation via the <TT CLASS="literal" >ZEND_GET_MODULE</TT > macro first: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" >#if COMPILE_DL_FIRSTMOD ZEND_GET_MODULE(firstmod) #endif</PRE ></TD ></TR ></TABLE ><P > The function implementation is surrounded by a conditional compilation statement. This is needed since the function <B CLASS="function" >get_module()</B > is only required if your module is built as a dynamic extension. By specifying a definition of <TT CLASS="literal" >COMPILE_DL_FIRSTMOD</TT > in the compiler command (see above for a discussion of the compilation instructions required to build a dynamic extension), you can instruct your module whether you intend to build it as a dynamic extension or as a built-in module. If you want a built-in module, the implementation of <B CLASS="function" >get_module()</B > is simply left out. </P ><P > <B CLASS="function" >get_module()</B > is called by Zend at load time of the module. You can think of it as being invoked by the <A HREF="function.dl.html" ><B CLASS="function" >dl()</B ></A > call in your script. Its purpose is to pass the module information block back to Zend in order to inform the engine about the module contents. </P ><P > If you don't implement a <B CLASS="function" >get_module()</B > function in your dynamic loadable module, Zend will compliment you with an error message when trying to access it. </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="zend.structure.module-block.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="zend.structure.implementation.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Declaration of the Zend Module Block</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="zend.structure.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Implementation of All Exported Functions</TD ></TR ></TABLE ></DIV ></BODY ></HTML >