[ SEA-GHOST MINI SHELL]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>5.3. Modules that require system libraries</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="Linux-PAM_MWG.html" title="The Linux-PAM Module Writers' Guide"><link rel="up" href="mwg-see-programming.html" title="Chapter 5. Programming notes"><link rel="prev" href="mwg-see-programming-syslog.html" title="5.2. Use of syslog(3)"><link rel="next" href="mwg-example.html" title="Chapter 6. An example module"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.3. Modules that require system libraries</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="mwg-see-programming-syslog.html">Prev</a> </td><th width="60%" align="center">Chapter 5. Programming notes</th><td width="20%" align="right"> <a accesskey="n" href="mwg-example.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mwg-see-programming-libs"></a>5.3. Modules that require system libraries</h2></div></div></div><p>
Writing a module is much like writing an application. You
have to provide the "conventional hooks" for it to work
correctly, like <code class="function">pam_sm_authenticate()</code>
etc., which would correspond to the <code class="function">main()</code>
function in a normal function.
</p><p>
Typically, the author may want to link against some standard system
libraries. As when one compiles a normal program, this can be
done for modules too: you simply append the
<em class="parameter"><code>-l</code></em><span class="emphasis"><em>XXX</em></span> arguments
for the desired libraries when you create the shared module object.
To make sure a module is linked to the
<span class="command"><strong>libwhatever.so</strong></span> library
when it is <code class="function">dlopen()</code>ed, try:
</p><pre class="programlisting">
% gcc -shared -o pam_module.so pam_module.o -lwhatever
</pre><p>
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="mwg-see-programming-syslog.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="mwg-see-programming.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="mwg-example.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5.2. Use of <span class="citerefentry"><span class="refentrytitle">syslog</span>(3)</span> </td><td width="20%" align="center"><a accesskey="h" href="Linux-PAM_MWG.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. An example module</td></tr></table></div></body></html>
SEA-GHOST - SHELL CODING BY SEA-GHOST