<chapter id="modules">
<chapterinfo>
- <author>
- <firstname>Jelmer</firstname><surname>Vernooij</surname>
- <affiliation>
- <orgname>Samba Team</orgname>
- <address><email>jelmer@samba.org</email></address>
- </affiliation>
- </author>
+ &author.jelmer;
<pubdate> 19 March 2003 </pubdate>
</chapterinfo>
</programlisting></para>
<para>
-These functions should be called before the subsystem is used. That can be
-done either from the executable that will be using the subsystem (
-static_init_rpc is called from the main() function of smbd), or
-from the subsystem itself when it's first used (like passdb's
-lazy_initialise_passdb does).
+These functions should be called before the subsystem is used. That
+should be done when the subsystem is initialised or first used.
</para>
</sect2>
<para>
Each module has an initialisation function. For modules that are
-included with samba this name is '<replaceable>subsystem</replaceable>_<replaceable>backend</replaceable>_init'. For external modules (that will never be built-in, but only available as a module) this name is always 'module_init'. (In the case of modules included with samba, the configure system will add a #define subsystem_backend_init() module_init()).
+included with samba this name is '<replaceable>subsystem</replaceable>_<replaceable>backend</replaceable>_init'. For external modules (that will never be built-in, but only available as a module) this name is always 'init_module'. (In the case of modules included with samba, the configure system will add a #define subsystem_backend_init() init_module()).
The prototype for these functions is:
</para>
<para><programlisting>
-int module_init(void);
+int init_module(void);
</programlisting></para>
<para>This function should call one or more
<para>Syntax:</para>
<para><programlisting>
-SMB_MODULE($MODULE_<replaceable>subsystem</replaceable>_<replaceable>backend</replaceable>, <replaceable>subsystem</replaceable>_<replaceable>backend</replaceable>, <replaceable>object files</replaceable>, <replaceable>plugin name</replaceable>, <replaceable>subsystem name</replaceable>)
+SMB_MODULE(<replaceable>subsystem</replaceable>_<replaceable>backend</replaceable>, <replaceable>object files</replaceable>, <replaceable>plugin name</replaceable>, <replaceable>subsystem name</replaceable>, <replaceable>static_action</replaceable>, <replaceable>shared_action</replaceable>)
SMB_SUBSYSTEM(<replaceable>subsystem</replaceable>)
</programlisting></para>
+<para>Also, make sure to add the correct directives to
+<filename>Makefile.in</filename>. <replaceable>@SUBSYSTEM_STATIC@</replaceable>
+will be replaced with a list of objects files of the modules that need to
+be linked in statically. <replaceable>@SUBSYSTEM_MODULES@</replaceable> will
+be replaced with the names of the plugins to build.
+</para>
+
+<para>You must make sure all .c files that contain defines that can
+be changed by ./configure are rebuilded in the 'modules_clean' make target.
+Practically, this means all c files that contain <command>static_init_subsystem;</command> calls need to be rebuilded.
+</para>
+
</sect2>
</sect1>
</chapter>