⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autobook_176.html

📁 Autoconf使用手册
💻 HTML
字号:
<HTML><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!-- Created on September, 12  2004 by texi2html 1.64 --><!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)            Karl Berry  <karl@freefriends.org>            Olaf Bachmann <obachman@mathematik.uni-kl.de>            and many others.Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> --><HEAD><TITLE>Autoconf, Automake, and Libtool: libltdl Loader Management</TITLE><META NAME="description" CONTENT="Autoconf, Automake, and Libtool: libltdl Loader Management"><META NAME="keywords" CONTENT="Autoconf, Automake, and Libtool: libltdl Loader Management"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META NAME="Generator" CONTENT="texi2html 1.64"><script language="Javascript"><!--    // Check the browser version.    function checkVersion() {      if (navigator.appVersion.charAt(0)>=3) return true;      if (navigator.appVersion.charAt(0)>=4) return true;      else return false;    }      if (checkVersion()) {             homeon = new Image();             homeon.src = "homeon.png";             homeoff = new Image();             homeoff.src = "home.png";             tocon = new Image();             tocon.src = "tocon.png";             tocoff = new Image();             tocoff.src = "toc.png";             indexon = new Image();             indexon.src = "indexon.png";             indexoff = new Image();             indexoff.src = "index.png";             helpon = new Image();             helpon.src = "helpon.png";             helpoff = new Image();             helpoff.src = "help.png";             backon = new Image();             backon.src = "backon.png";             backoff = new Image();             backoff.src = "back.png";             forwardon = new Image();             forwardon.src = "forwardon.png";             forwardoff = new Image();             forwardoff.src = "forward.png";             prevon = new Image();             prevon.src = "prevon.png";             prevoff = new Image();             prevoff.src = "prev.png";             nexton = new Image();             nexton.src = "nexton.png";             nextoff = new Image();             nextoff.src = "next.png";             upon = new Image();             upon.src = "upon.png";             upoff = new Image();             upoff.src = "up.png";         }     function img_act(imgName) {             if (checkVersion()) {             imgOn = eval(imgName + "on.src");             document [imgName].src = imgOn;             }     }     function img_inact(imgName) {             if (checkVersion()) {             imgOff = eval(imgName + "off.src");             document [imgName].src = imgOff;             }     }// --></SCRIPT></HEAD><BODY LANG="EN" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#6688AA" VLINK="#336688" ALINK="#808080"><A NAME="SEC176"></A><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=10><TR VALIGN="TOP"><TD ALIGN="MIDDLE" WIDTH=50 BGCOLOR="#e6e6e6"><TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_175.html#SEC175" onMouseover="img_act('prev')" onMouseout="img_inact('prev')"><IMG SRC="prev.png" BORDER="0" ALT="Back: libltdl Loader Mechanism" ALIGN="MIDDLE" NAME="prev"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_177.html#SEC177" onMouseover="img_act('next')" onMouseout="img_inact('next')"><IMG SRC="next.png" BORDER="0" ALT="Forward: libltdl Loader Errors" ALIGN="MIDDLE" NAME="next"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_177.html#SEC177" onMouseover="img_act('back')" onMouseout="img_inact('back')"><IMG SRC="back.png" BORDER="0" ALT="FastBack: libltdl Loader Errors" ALIGN="MIDDLE" NAME="back"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_174.html#SEC174" onMouseover="img_act('up')" onMouseout="img_inact('up')"><IMG SRC="up.png" BORDER="0" ALT="Up: User Module Loaders" ALIGN="MIDDLE" NAME="up"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_178.html#SEC178" onMouseover="img_act('forward')" onMouseout="img_inact('forward')"><IMG SRC="forward.png" BORDER="0" ALT="FastForward: Advanced GNU Automake Usage" ALIGN="MIDDLE" NAME="forward"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook.html#SEC_Top" onMouseover="img_act('home')" onMouseout="img_inact('home')"><IMG SRC="home.png" BORDER="0" ALT="Top: Autoconf, Automake, and Libtool" ALIGN="MIDDLE" NAME="home"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_toc.html#SEC_Contents" onMouseover="img_act('toc')" onMouseout="img_inact('toc')"><IMG SRC="toc.png" BORDER="0" ALT="Contents: Table of Contents" ALIGN="MIDDLE" NAME="toc"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_285.html#SEC285" onMouseover="img_act('index')" onMouseout="img_inact('index')"><IMG SRC="index.png" BORDER="0" ALT="Index: Index" ALIGN="MIDDLE" NAME="index"></A></TD></TR><TR VALIGN="TOP" ALIGN="LEFT"><TD VALIGN="MIDDLE" ALIGN="LEFT"><A HREF="autobook_abt.html#SEC_About" onMouseover="img_act('help')" onMouseout="img_inact('help')"><IMG SRC="help.png" BORDER="0" ALT="About: About this document" ALIGN="MIDDLE" NAME="help"></A></TD></TR></TABLE></TD><TD ALIGN="LEFT"><H3> 18.5.2 Loader Management </H3><!--docid::SEC176::--><P>The API supplies all of the functions you need to implement yourown module loading mechanisms to solve problems just like this:</P><P><A NAME="IDX38"></A><DL><DT><U>Function:</U> lt_dlloader_t * <B>lt_dlloader_find</B> <I>(const char *<VAR>loader_name</VAR>)</I><DD>Each of the module loaders implemented by libltdl is storedaccording to a unique name, which can be used to lookup the associatedhandle.  These handles operate in much the same way as<CODE>lt_dlhandle</CODE>s:  They are used for passing references to modules inand out of the API, except that they represent a kind of<EM>module loading method</EM>, as opposed to a loaded module instance.</P><P>This function finds the <SAMP>`lt_dlloader_t'</SAMP> handle associated with theunique name passed as the only argument, or else returns <SAMP>`NULL'</SAMP> ifthere is no such module loader registered.</DL></P><P><A NAME="IDX39"></A><DL><DT><U>Function:</U> int <B>lt_dlloader_add</B> <I>(lt_dlloader_t *<VAR>place</VAR>, lt_user_dlloader *<VAR>dlloader</VAR>, const char *<VAR>loader_name</VAR>)</I><DD>This function is used to register your own module loading mechanismswith libltdl.  If <VAR>place</VAR> is given it must be a handle for analready registered module loader, which the new loader <VAR>dlloader</VAR>will be placed in front of for the purposes of which order to tryloaders in.  If <VAR>place</VAR> is <SAMP>`NULL'</SAMP>, on the other hand, the new<VAR>dlloader</VAR> will be added to the end of the list of loaders to trywhen loading a module instance. In either case <VAR>loader_name</VAR> must bea unique name for use with <CODE>lt_dlloader_find</CODE>.</P><P>The <VAR>dlloader</VAR> argument must be a C structure of the followingformat, populated with suitable function pointers which determine thefunctionality of your module loader:</P><P><TABLE width=100%><tr><td>&nbsp;</td><td class=example bgcolor=#6688aa><br><pre>struct lt_user_dlloader {  const char         *sym_prefix;  lt_module_open_t   *module_open;  lt_module_close_t  *module_close;  lt_find_sym_t      *find_sym;  lt_dlloader_exit_t *dlloader_exit;  lt_dlloader_data_t dlloader_data;};</pre></td></tr></table></DL></P><P><A NAME="IDX40"></A><DL><DT><U>Function:</U> int <B>lt_dlloader_remove</B> <I>(const char *<VAR>loader_name</VAR>)</I><DD>When there are no more loaded modules that were opened by the givenmodule loader, the loader itself can be removed using this function. </DL></P><P>When you come to set the fields in the <CODE>lt_user_dlloader</CODE>structure, they must each be of the correct type, as described below:</P><P><A NAME="IDX41"></A><DL><DT><U>Type:</U> const char * <B>sym_prefix</B><DD>If a particular module loader relies on a prefix to each symbol beinglooked up (for example, the Windows module loader necessarily adds a<SAMP>`_'</SAMP> prefix to each symbol name passed to <CODE>lt_dlsym</CODE>), it shouldbe recorded in the <SAMP>`sym_prefix'</SAMP> field.</DL></P><P><A NAME="IDX42"></A><DL><DT><U>Type:</U> lt_module_t <B>lt_module_open_t</B> <I>(lt_dlloader_data_t <VAR>loader_data</VAR>, const char *<VAR>module_name</VAR>)</I><DD>When <CODE>lt_dlopen</CODE> has reached your registered module loader whenattempting to load a dynamic module, this is the type of the<CODE>module_open</CODE> function that will be called.  The name of the modulethat libltdl is attempting to load, along with the module loaderinstance data associated with the loader being used currently, arepassed as arguments to such a function call.</P><P>The <CODE>lt_module_t</CODE> returned by functions of this type can beanything at all that can be recognised as unique to a successfullyloaded module instance when passed back into the <CODE>module_close</CODE> or<CODE>find_sym</CODE> functions in the <CODE>lt_user_dlloader</CODE> module loaderstructure.</DL></P><P><A NAME="IDX43"></A><DL><DT><U>Type:</U> int <B>lt_module_close_t</B> <I>(lt_dlloader_data_t <VAR>loader_data</VAR>, lt_module_t <VAR>module</VAR>)</I><DD>In a similar vein, a function of this type will be called by<CODE>lt_dlclose</CODE>, where <VAR>module</VAR> is the returned value from the<SAMP>`module_open'</SAMP> function which loaded this dynamic module instance.</DL></P><P><A NAME="IDX44"></A><DL><DT><U>Type:</U> lt_ptr_t <B>lt_find_sym_t</B> <I>(lt_dlloader_data_t <VAR>loader_data</VAR>, lt_module_t <VAR>module</VAR>,  const char *<VAR>symbol_name</VAR>)</I><DD>In a similar vein once more, a function of this type will be called by<CODE>lt_dlsym</CODE>, and must return the address of <VAR>symbol_name</VAR> in<VAR>module</VAR>.</DL></P><P><A NAME="IDX45"></A><DL><DT><U>Type:</U> int <B>lt_dlloader_exit_t</B> <I>(lt_dlloader_data_t <VAR>loader_data</VAR>)</I><DD>When a user module loader is <CODE>lt_dlloader_remove</CODE>d, a function ofthis type will be called.  That function is responsible for releasingany resources that were allocated during the initialisation of theloader, so that they are not `leaked' when the <CODE>lt_user_dlloader</CODE>structure is recycled.</P><P>Note that there is no initialisation function type:  the initialisationof a user module loader should be performed before the loader isregistered with <CODE>lt_dlloader_add</CODE>.</DL></P><P><A NAME="IDX46"></A><DL><DT><U>Type:</U> lt_dlloader_data_t <B>dlloader_data</B><DD>The <VAR>dlloader_data</VAR> is a spare field which can be used to store orpass any data specific to a particular module loader.  That data willalways be passed as the value of the first argument to each of theimplementation functions above.</DL></P><P><A NAME="libltdl Loader Errors"></A></TR></TABLE><BR>  <FONT SIZE="-1">This document was generatedby <I>Gary V. Vaughan</I> on <I>September, 12  2004</I>using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html"><I>texi2html</I></A></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -