📄 qlibrary.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/edba/dist/qtopia/main-Sunday/qtopia/src/libraries/qtopia/qlibrary.cpp:112 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QLibrary Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="200" align="left" valign="top"><a href="index.html"><img height="27" width="472" src="dochead.png" border="0"></a><br><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qtopia</font> <a href="index.html">Home</a> - <a href="qtopiaclasses.html">Classes</a> - <a href="qtopiaannotated.html">Annotated</a> - <a href="qtopiafunctions.html">Functions</a> - <a href="qtindex.html">Qt Embedded</a></td><td align="right" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="137"> <tr> <td><a href="http://www.trolltech.com/company/about/trolls.html"><img height="100" width="100" src="face.png" border="0"></a></td> <td><img height="100" width="100" src="qtlogo.png" align="top" border="0"></td> </tr> </table></td></tr></table><h1 align=center>QLibrary Class Reference</h1><p>The QLibrary class provides a wrapper for handling shared libraries.<a href="#details">More...</a><p><tt>#include <<a href="qlibrary-h.html">qlibrary.h</a>></tt><p><a href="qlibrary-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn>enum <a href="#Policy-enum"><b>Policy</b></a> { Delayed, Immediately, Manual }</div></li><li><div class=fn><a href="#QLibrary"><b>QLibrary</b></a> ( const QString & filename, Policy pol = Delayed )</div></li><li><div class=fn><a href="#~QLibrary"><b>~QLibrary</b></a> ()</div></li><li><div class=fn>void * <a href="#resolve"><b>resolve</b></a> ( const char * symb )</div></li><li><div class=fn>bool <a href="#unload"><b>unload</b></a> ( bool force = FALSE )</div></li><li><div class=fn>bool <a href="#isLoaded"><b>isLoaded</b></a> () const</div></li><li><div class=fn>void <a href="#setPolicy"><b>setPolicy</b></a> ( Policy pol )</div></li><li><div class=fn>Policy <a href="#policy"><b>policy</b></a> () const</div></li><li><div class=fn>QString <a href="#library"><b>library</b></a> () const</div></li><li><div class=fn>QRESULT <a href="#queryInterface"><b>queryInterface</b></a> ( const QUuid & request, QUnknownInterface ** iface )</div></li></ul><h2>Static Public Members</h2><ul><li><div class=fn>void * <a href="#resolve-2"><b>resolve</b></a> ( const QString & filename, const char * symb )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QLibrary class provides a wrapper for handling shared libraries.<p> This class is temporarily copied from Qt 3.0.<p> <p>See also <a href="qtopiaemb.html">Qtopia Classes</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="Policy-enum"></a>QLibrary::Policy</h3><p> This enum type defines the various policies a QLibrary can have with respect toloading and unloading the shared library.<p> The <em>policy</em> can be:<ul><li><tt>QLibrary::Delayed</tt> - The library get's loaded as soon as needed and unloaded in the destructor<li><tt>QLibrary::Immediately</tt> - The library is loaded immediately and unloaded in the destructor<li><tt>QLibrary::Manual</tt> - Like delayed, and library has to be unloaded manually</ul><hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QLibrary"></a>QLibrary::QLibrary ( const QString & filename, <a href="qlibrary.html#Policy-enum">Policy</a> pol = Delayed )</h3>Creates a QLibrary object for the shared library <em>filename</em>.The library get's loaded if <em>pol</em> is Immediately.<p> Note that <em>filename</em> does not need to include the (platform specific)file extension, so calling<p> <pre> QLibrary lib( "mylib" ); </pre> <p> would be equivalent to<p> <pre> QLibrary lib( "mylib.dll" ); </pre> <p> on Windows. But <em>"mylib.dll"</em> will obviously not work on other platforms.<p> <p>See also <a href="#setPolicy">setPolicy</a>() and <a href="#unload">unload</a>().<h3 class=fn><a name="~QLibrary"></a>QLibrary::~QLibrary ()</h3>Deletes the QLibrary object.The library will be unloaded if the policy is not Manual.<p> <p>See also <a href="#unload">unload</a>() and <a href="#setPolicy">setPolicy</a>().<h3 class=fn>bool <a name="isLoaded"></a>QLibrary::isLoaded () const</h3>Returns whether the library is loaded.<p> <p>See also <a href="#unload">unload</a>().<h3 class=fn>QString <a name="library"></a>QLibrary::library () const</h3>Returns the filename of the shared library this QLibrary object handles,including the platform specific file extension.<p> <pre> QLibrary lib( "mylib" ); QString str = lib.<a href="#library">library</a>(); </pre> <p> will set <em>str</em> to "mylib.dll" on Windows, and "libmylib.so" on Linux.<h3 class=fn><a href="qlibrary.html#Policy-enum">Policy</a> <a name="policy"></a>QLibrary::policy () const</h3>Returns the current policy.<p> <p>See also <a href="#setPolicy">setPolicy</a>().<h3 class=fn>QRESULT <a name="queryInterface"></a>QLibrary::queryInterface ( const <a href="quuid.html">QUuid</a> & request, QUnknownInterface ** iface )</h3>Forwards the query to the component and returns the result. <em>request</em> and <em>iface</em>are propagated to the component's queryInterface implementation.<p> The library gets loaded if necessary.<h3 class=fn>void * <a name="resolve"></a>QLibrary::resolve ( const char * symb )</h3>Returns the address of the exported symbol <em>symb</em>. The library getsloaded if necessary. The function returns NULL if the symbol couldnot be resolved, or if loading the library failed.<p> <pre> typedef int (*addProc)( int, int ); addProc add = (addProc) library->resolve( "add" ); if ( add ) return add( 5, 8 ); else return 5 + 8; </pre> <p> <p>See also <a href="#queryInterface">queryInterface</a>().<h3 class=fn>void * <a name="resolve-2"></a>QLibrary::resolve ( const QString & filename, const char * symb )<tt> [static]</tt></h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> Loads the library <em>filename</em> and returns the address of the exported symbol <em>symb</em>.Note that like for the constructor, <em>filename</em> does not need to include the (platform specific)file extension. The library staying loaded until the process exits.<p> The function returns a null pointer if the symbol could not be resolved or if loadingthe library failed.<h3 class=fn>void <a name="setPolicy"></a>QLibrary::setPolicy ( <a href="qlibrary.html#Policy-enum">Policy</a> pol )</h3>Sets the current policy to <em>pol</em>.The library is loaded if <em>pol</em> is set to Immediately.<h3 class=fn>bool <a name="unload"></a>QLibrary::unload ( bool force = FALSE )</h3>Releases the component and unloads the library when successful.Returns TRUE if the library could be unloaded, otherwise FALSE.If the component implements the QLibraryInterface, the cleanup()function of this interface will be called. The unloading will becancelled if the subsequent call to canUnload() returns FALSE.<p> This function gets called automatically in the destructor ifthe policy is not Manual.<p> <b>Warning:</b>If <em>force</em> is set to TRUE, the library gets unloaded at any cost,which is in most cases a segmentation fault, so you should know whatyou're doing!<p> <p>See also <a href="#queryInterface">queryInterface</a>() and <a href="#resolve">resolve</a>().<!-- eof --><hr><p>This file is part of the <a href="../index.html">Qtopia</a> platform,copyright © 1995-2004<a href="http://www.trolltech.com/">Trolltech</a>, all rights reserved.<p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright © 2001-2004 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align="right"><div align="right">Qtopia version 2.0.0</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -