Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 5639

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qlibrary.cpp -->
  <title>Qt 4.8: QLibrary Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QLibrary</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QLibrary Class Reference</h1>
<!-- $$$QLibrary-brief -->
<p>The QLibrary class loads shared libraries at runtime. <a href="#details">More...</a></p>
<!-- @@@QLibrary -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QLibrary&gt;</span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qlibrary-members.html">List of all members, including inherited members</a></li>
<li><a href="qlibrary-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#LoadHint-enum">LoadHint</a></b> { ResolveAllSymbolsHint, ExportExternalSymbolsHint, LoadArchiveMemberHint }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#LoadHint-enum">LoadHints</a></b></td></tr>
</table>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><a href="qlibrary.html#fileName-prop">fileName</a></b> : QString</li>
<li class="fn"><b><a href="qlibrary.html#loadHints-prop">loadHints</a></b> : LoadHints</li>
</ul>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#QLibrary">QLibrary</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#QLibrary-2">QLibrary</a></b> ( const QString &amp; <i>fileName</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#QLibrary-3">QLibrary</a></b> ( const QString &amp; <i>fileName</i>, int <i>verNum</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#QLibrary-4">QLibrary</a></b> ( const QString &amp; <i>fileName</i>, const QString &amp; <i>version</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#dtor.QLibrary">~QLibrary</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#errorString">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#fileName-prop">fileName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#isLoaded">isLoaded</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#load">load</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> LoadHints </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#loadHints-prop">loadHints</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void * </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#resolve">resolve</a></b> ( const char * <i>symbol</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#fileName-prop">setFileName</a></b> ( const QString &amp; <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#setFileNameAndVersion">setFileNameAndVersion</a></b> ( const QString &amp; <i>fileName</i>, int <i>versionNumber</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#setFileNameAndVersion-2">setFileNameAndVersion</a></b> ( const QString &amp; <i>fileName</i>, const QString &amp; <i>version</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#loadHints-prop">setLoadHints</a></b> ( LoadHints <i>hints</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#unload">unload</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#isLibrary">isLibrary</a></b> ( const QString &amp; <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void * </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#resolve-2">resolve</a></b> ( const QString &amp; <i>fileName</i>, const char * <i>symbol</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void * </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#resolve-3">resolve</a></b> ( const QString &amp; <i>fileName</i>, int <i>verNum</i>, const char * <i>symbol</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void * </td><td class="memItemRight bottomAlign"><b><a href="qlibrary.html#resolve-4">resolve</a></b> ( const QString &amp; <i>fileName</i>, const QString &amp; <i>version</i>, const char * <i>symbol</i> )</td></tr>
</table>
<ul>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QLibrary-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QLibrary class loads shared libraries at runtime.</p>
<p>An instance of a QLibrary object operates on a single shared object file (which we call a &quot;library&quot;, but is also known as a &quot;DLL&quot;). A QLibrary provides access to the functionality in the library in a platform independent way. You can either pass a file name in the constructor, or set it explicitly with <a href="qlibrary.html#fileName-prop">setFileName</a>(). When loading the library, QLibrary searches in all the system-specific library locations (e.g&#x2e; <tt>LD_LIBRARY_PATH</tt> on Unix), unless the file name has an absolute path. If the file cannot be found, QLibrary tries the name with different platform-specific file suffixes, like &quot;.so&quot; on Unix, &quot;.dylib&quot; on the Mac, or &quot;.dll&quot; on Windows and Symbian. This makes it possible to specify shared libraries that are only identified by their basename (i.e&#x2e; without their suffix), so the same code will work on different operating systems.</p>
<p>The most important functions are <a href="qlibrary.html#load">load</a>() to dynamically load the library file, <a href="qlibrary.html#isLoaded">isLoaded</a>() to check whether loading was successful, and <a href="qlibrary.html#resolve">resolve</a>() to resolve a symbol in the library. The <a href="qlibrary.html#resolve">resolve</a>() function implicitly tries to load the library if it has not been loaded yet. Multiple instances of QLibrary can be used to access the same physical library. Once loaded, libraries remain in memory until the application terminates. You can attempt to unload a library using <a href="qlibrary.html#unload">unload</a>(), but if other instances of QLibrary are using the same library, the call will fail, and unloading will only happen when every instance has called <a href="qlibrary.html#unload">unload</a>().</p>
<p>A typical use of QLibrary is to resolve an exported symbol in a library, and to call the C function that this symbol represents. This is called &quot;explicit linking&quot; in contrast to &quot;implicit linking&quot;, which is done by the link step in the build process when linking an executable against a library.</p>
<p>Note: In Symbian resolving symbols using their names is supported only if the library is built as STDDLL. Otherwise ordinals must be used. Also, in Symbian the path of the library is ignored and system default library location is always used.</p>
<p>The following code snippet loads a library, resolves the symbol &quot;mysymbol&quot;, and calls the function if everything succeeded. If something goes wrong, e.g&#x2e; the library file does not exist or the symbol is not defined, the function pointer will be 0 and won't be called.</p>
<pre class="cpp"> <span class="type">QLibrary</span> myLib(<span class="string">&quot;mylib&quot;</span>);
 <span class="keyword">typedef</span> <span class="type">void</span> (<span class="operator">*</span>MyPrototype)();
 MyPrototype myFunction <span class="operator">=</span> (MyPrototype) myLib<span class="operator">.</span><a href="qlibrary.html#resolve">resolve</a>(<span class="string">&quot;mysymbol&quot;</span>);
 <span class="keyword">if</span> (myFunction)
     myFunction();</pre>
<p>The symbol must be exported as a C function from the library for <a href="qlibrary.html#resolve">resolve</a>() to work. This means that the function must be wrapped in an <tt>extern &quot;C&quot;</tt> block if the library is compiled with a C++ compiler. On Windows, this also requires the use of a <tt>dllexport</tt> macro; see <a href="qlibrary.html#resolve">resolve</a>() for the details of how this is done. For convenience, there is a static <a href="qlibrary.html#resolve">resolve</a>() function which you can use if you just want to call a function in a library without explicitly loading the library first:</p>
<pre class="cpp"> <span class="keyword">typedef</span> <span class="type">void</span> (<span class="operator">*</span>MyPrototype)();
 MyPrototype myFunction <span class="operator">=</span>
         (MyPrototype) <span class="type">QLibrary</span><span class="operator">::</span><a href="qlibrary.html#resolve">resolve</a>(<span class="string">&quot;mylib&quot;</span><span class="operator">,</span> <span class="string">&quot;mysymbol&quot;</span>);
 <span class="keyword">if</span> (myFunction)
     myFunction();</pre>
</div>
<p><b>See also </b><a href="qpluginloader.html">QPluginLoader</a>.</p>
<!-- @@@QLibrary -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$LoadHint$$$ResolveAllSymbolsHint$$$ExportExternalSymbolsHint$$$LoadArchiveMemberHint$$$ImprovedSearchHeuristics -->
<h3 class="flags"><a name="LoadHint-enum"></a>enum QLibrary::<span class="name">LoadHint</span><br/>flags QLibrary::<span class="name">LoadHints</span></h3>
<p>This enum describes the possible hints that can be used to change the way libraries are handled when they are loaded. These values indicate how symbols are resolved when libraries are loaded, and are specified using the <a href="qlibrary.html#loadHints-prop">setLoadHints</a>() function.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QLibrary::ResolveAllSymbolsHint</tt></td><td class="topAlign"><tt>0x01</tt></td><td class="topAlign">Causes all symbols in a library to be resolved when it is loaded, not simply when <a href="qlibrary.html#resolve">resolve</a>() is called.</td></tr>
<tr><td class="topAlign"><tt>QLibrary::ExportExternalSymbolsHint</tt></td><td class="topAlign"><tt>0x02</tt></td><td class="topAlign">Exports unresolved and external symbols in the library so that they can be resolved in other dynamically-loaded libraries loaded later.</td></tr>
<tr><td class="topAlign"><tt>QLibrary::LoadArchiveMemberHint</tt></td><td class="topAlign"><tt>0x04</tt></td><td class="topAlign">Allows the file name of the library to specify a particular object file within an archive file. If this hint is given, the filename of the library consists of a path, which is a reference to an archive file, followed by a reference to the archive member.</td></tr>
</table>
<p>The LoadHints type is a typedef for <a href="qflags.html">QFlags</a>&lt;LoadHint&gt;. It stores an OR combination of LoadHint values.</p>
<p><b>See also </b><a href="qlibrary.html#loadHints-prop">loadHints</a>.</p>
<!-- @@@LoadHint -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$fileName-prop$$$fileName$$$setFileNameconstQString& -->
<h3 class="fn"><a name="fileName-prop"></a><span class="name">fileName</span> : <span class="type"><a href="qstring.html">QString</a></span></h3>
<p>This property holds the file name of the library.</p>
<p>We recommend omitting the file's suffix in the file name, since <a href="qlibrary.html">QLibrary</a> will automatically look for the file with the appropriate suffix (see <a href="qlibrary.html#isLibrary">isLibrary</a>()).</p>
<p>When loading the library, <a href="qlibrary.html">QLibrary</a> searches in all system-specific library locations (e.g&#x2e; <tt>LD_LIBRARY_PATH</tt> on Unix), unless the file name has an absolute path. After loading the library successfully, fileName() returns the fully-qualified file name of the library, including the full path to the library if one was given in the constructor or passed to setFileName().</p>
<p>For example, after successfully loading the &quot;GL&quot; library on Unix platforms, fileName() will return &quot;libGL.so&quot;. If the file name was originally passed as &quot;/usr/lib/libGL&quot;, fileName() will return &quot;/usr/lib/libGL.so&quot;.</p>
<p>Note: In Symbian the path portion of the <i>fileName</i> is ignored.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QString </td><td class="memItemRight bottomAlign"><span class="name"><b>fileName</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setFileName</b></span> ( const QString &amp; <i>fileName</i> )</td></tr>
</table>
<!-- @@@fileName -->
<!-- $$$loadHints-prop$$$loadHints$$$setLoadHintsLoadHints -->
<h3 class="fn"><a name="loadHints-prop"></a><span class="name">loadHints</span> : <span class="type"><a href="qlibrary.html#LoadHint-enum">LoadHints</a></span></h3>
<p>This property holds give the load() function some hints on how it should behave.</p>
<p>You can give some hints on how the symbols are resolved. Usually, the symbols are not resolved at load time, but resolved lazily, (that is, when <a href="qlibrary.html#resolve">resolve</a>() is called). If you set the loadHint to <a href="qlibrary.html#LoadHint-enum">ResolveAllSymbolsHint</a>, then all symbols will be resolved at load time if the platform supports it.</p>
<p>Setting <a href="qlibrary.html#LoadHint-enum">ExportExternalSymbolsHint</a> will make the external symbols in the library available for resolution in subsequent loaded libraries.</p>
<p>If <a href="qlibrary.html#LoadHint-enum">LoadArchiveMemberHint</a> is set, the file name is composed of two components: A path which is a reference to an archive file followed by the second component which is the reference to the archive member. For instance, the <a href="qlibrary.html#fileName-prop">fileName</a> <tt>libGL.a(shr_64.o)</tt> will refer to the library <tt>shr_64.o</tt> in the archive file named <tt>libGL.a</tt>. This is only supported on the AIX platform.</p>
<p>The interpretation of the load hints is platform dependent, and if you use it you are probably making some assumptions on which platform you are compiling for, so use them only if you understand the consequences of them.</p>
<p>By default, none of these flags are set, so libraries will be loaded with lazy symbol resolution, and will not export external symbols for resolution in other dynamically-loaded libraries.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> LoadHints </td><td class="memItemRight bottomAlign"><span class="name"><b>loadHints</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setLoadHints</b></span> ( LoadHints <i>hints</i> )</td></tr>
</table>
<!-- @@@loadHints -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QLibrary[overload1]$$$QLibraryQObject* -->
<h3 class="fn"><a name="QLibrary"></a>QLibrary::<span class="name">QLibrary</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a library with the given <i>parent</i>.</p>
<!-- @@@QLibrary -->
<!-- $$$QLibrary$$$QLibraryconstQString&QObject* -->
<h3 class="fn"><a name="QLibrary-2"></a>QLibrary::<span class="name">QLibrary</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a library object with the given <i>parent</i> that will load the library specified by <i>fileName</i>.</p>
<p>We recommend omitting the file's suffix in <i>fileName</i>, since <a href="qlibrary.html">QLibrary</a> will automatically look for the file with the appropriate suffix in accordance with the platform, e.g&#x2e; &quot;.so&quot; on Unix, &quot;.dylib&quot; on Mac OS X, and &quot;.dll&quot; on Windows. (See <a href="qlibrary.html#fileName-prop">fileName</a>.)</p>
<p>Note: In Symbian the path portion of the <i>fileName</i> is ignored.</p>
<!-- @@@QLibrary -->
<!-- $$$QLibrary$$$QLibraryconstQString&intQObject* -->
<h3 class="fn"><a name="QLibrary-3"></a>QLibrary::<span class="name">QLibrary</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, <span class="type">int</span> <i>verNum</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a library object with the given <i>parent</i> that will load the library specified by <i>fileName</i> and major version number <i>verNum</i>. Currently, the version number is ignored on Windows and Symbian.</p>
<p>We recommend omitting the file's suffix in <i>fileName</i>, since <a href="qlibrary.html">QLibrary</a> will automatically look for the file with the appropriate suffix in accordance with the platform, e.g&#x2e; &quot;.so&quot; on Unix, &quot;.dylib&quot; on Mac OS X, and &quot;.dll&quot; on Windows. (See <a href="qlibrary.html#fileName-prop">fileName</a>.)</p>
<p>Note: In Symbian the path portion of the <i>fileName</i> is ignored.</p>
<!-- @@@QLibrary -->
<!-- $$$QLibrary$$$QLibraryconstQString&constQString&QObject* -->
<h3 class="fn"><a name="QLibrary-4"></a>QLibrary::<span class="name">QLibrary</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>version</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a library object with the given <i>parent</i> that will load the library specified by <i>fileName</i> and full version number <i>version</i>. Currently, the version number is ignored on Windows and Symbian.</p>
<p>We recommend omitting the file's suffix in <i>fileName</i>, since <a href="qlibrary.html">QLibrary</a> will automatically look for the file with the appropriate suffix in accordance with the platform, e.g&#x2e; &quot;.so&quot; on Unix, &quot;.dylib&quot; on Mac OS X, and &quot;.dll&quot; on Windows. (See <a href="qlibrary.html#fileName-prop">fileName</a>.)</p>
<p>Note: In Symbian the path portion of the <i>fileName</i> is ignored.</p>
<!-- @@@QLibrary -->
<!-- $$$~QLibrary[overload1]$$$~QLibrary -->
<h3 class="fn"><a name="dtor.QLibrary"></a>QLibrary::<span class="name">~QLibrary</span> ()</h3>
<p>Destroys the <a href="qlibrary.html">QLibrary</a> object.</p>
<p>Unless <a href="qlibrary.html#unload">unload</a>() was called explicitly, the library stays in memory until the application terminates.</p>
<p><b>See also </b><a href="qlibrary.html#isLoaded">isLoaded</a>() and <a href="qlibrary.html#unload">unload</a>().</p>
<!-- @@@~QLibrary -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn"><a name="errorString"></a><span class="type"><a href="qstring.html">QString</a></span> QLibrary::<span class="name">errorString</span> () const</h3>
<p>Returns a text string with the description of the last error that occurred. Currently, errorString will only be set if <a href="qlibrary.html#load">load</a>(), <a href="qlibrary.html#unload">unload</a>() or <a href="qlibrary.html#resolve">resolve</a>() for some reason fails.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@errorString -->
<!-- $$$isLibrary[overload1]$$$isLibraryconstQString& -->
<h3 class="fn"><a name="isLibrary"></a><span class="type">bool</span> QLibrary::<span class="name">isLibrary</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i> )<tt> [static]</tt></h3>
<p>Returns true if <i>fileName</i> has a valid suffix for a loadable library; otherwise returns false.</p>
<table class="generic">
<thead><tr class="qt-style"><th >Platform</th><th >Valid suffixes</th></tr></thead>
<tr valign="top" class="odd"><td >Windows</td><td ><tt>.dll</tt>, <tt>.DLL</tt></td></tr>
<tr valign="top" class="even"><td >Unix/Linux</td><td ><tt>.so</tt></td></tr>
<tr valign="top" class="odd"><td >AIX</td><td ><tt>.a</tt></td></tr>
<tr valign="top" class="even"><td >HP-UX</td><td ><tt>.sl</tt>, <tt>.so</tt> (HP-UXi)</td></tr>
<tr valign="top" class="odd"><td >Mac OS X</td><td ><tt>.dylib</tt>, <tt>.bundle</tt>, <tt>.so</tt></td></tr>
<tr valign="top" class="even"><td >Symbian</td><td ><tt>.dll</tt></td></tr>
</table>
<p>Trailing versioning numbers on Unix are ignored.</p>
<!-- @@@isLibrary -->
<!-- $$$isLoaded[overload1]$$$isLoaded -->
<h3 class="fn"><a name="isLoaded"></a><span class="type">bool</span> QLibrary::<span class="name">isLoaded</span> () const</h3>
<p>Returns true if the library is loaded; otherwise returns false.</p>
<p><b>See also </b><a href="qlibrary.html#load">load</a>().</p>
<!-- @@@isLoaded -->
<!-- $$$load[overload1]$$$load -->
<h3 class="fn"><a name="load"></a><span class="type">bool</span> QLibrary::<span class="name">load</span> ()</h3>
<p>Loads the library and returns true if the library was loaded successfully; otherwise returns false. Since <a href="qlibrary.html#resolve">resolve</a>() always calls this function before resolving any symbols it is not necessary to call it explicitly. In some situations you might want the library loaded in advance, in which case you would use this function.</p>
<p><b>See also </b><a href="qlibrary.html#unload">unload</a>().</p>
<!-- @@@load -->
<!-- $$$resolve[overload1]$$$resolveconstchar* -->
<h3 class="fn"><a name="resolve"></a><span class="type">void</span> * QLibrary::<span class="name">resolve</span> ( const <span class="type">char</span> * <i>symbol</i> )</h3>
<p>Returns the address of the exported symbol <i>symbol</i>. The library is loaded if necessary. The function returns 0 if the symbol could not be resolved or if the library could not be loaded.</p>
<p>Example:</p>
<pre class="cpp"> <span class="keyword">typedef</span> <span class="type">int</span> (<span class="operator">*</span>AvgFunction)(<span class="type">int</span><span class="operator">,</span> <span class="type">int</span>);

 AvgFunction avg <span class="operator">=</span> (AvgFunction) library<span class="operator">-</span><span class="operator">&gt;</span>resolve(<span class="string">&quot;avg&quot;</span>);
 <span class="keyword">if</span> (avg)
     <span class="keyword">return</span> avg(<span class="number">5</span><span class="operator">,</span> <span class="number">8</span>);
 <span class="keyword">else</span>
     <span class="keyword">return</span> <span class="operator">-</span><span class="number">1</span>;</pre>
<p>The symbol must be exported as a C function from the library. This means that the function must be wrapped in an <tt>extern &quot;C&quot;</tt> if the library is compiled with a C++ compiler. On Windows you must also explicitly export the function from the DLL using the <tt>__declspec(dllexport)</tt> compiler directive, for example:</p>
<pre class="cpp"> <span class="keyword">extern</span> <span class="string">&quot;C&quot;</span> MY_EXPORT <span class="type">int</span> avg(<span class="type">int</span> a<span class="operator">,</span> <span class="type">int</span> b)
 {
     <span class="keyword">return</span> (a <span class="operator">+</span> b) <span class="operator">/</span> <span class="number">2</span>;
 }</pre>
<p>with <tt>MY_EXPORT</tt> defined as</p>
<pre class="cpp"> <span class="preprocessor">#ifdef Q_WS_WIN</span>
 <span class="preprocessor">#define MY_EXPORT __declspec(dllexport)</span>
 <span class="preprocessor">#else</span>
 <span class="preprocessor">#define MY_EXPORT</span>
 <span class="preprocessor">#endif</span></pre>
<p>Note: In Symbian resolving with symbol names works only if the loaded library was built as STDDLL. Otherwise, the ordinals must be used.</p>
<!-- @@@resolve -->
<!-- $$$resolve$$$resolveconstQString&constchar* -->
<h3 class="fn"><a name="resolve-2"></a><span class="type">void</span> * QLibrary::<span class="name">resolve</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, const <span class="type">char</span> * <i>symbol</i> )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<p>Loads the library <i>fileName</i> and returns the address of the exported symbol <i>symbol</i>. Note that <i>fileName</i> should not include the platform-specific file suffix; (see <a href="qlibrary.html#fileName-prop">fileName</a>). The library remains loaded until the application exits.</p>
<p>The function returns 0 if the symbol could not be resolved or if the library could not be loaded.</p>
<p>Note: In Symbian resolving with symbol names works only if the loaded library was built as STDDLL. Otherwise, the ordinals must be used.</p>
<p><b>See also </b><a href="qlibrary.html#resolve">resolve</a>().</p>
<!-- @@@resolve -->
<!-- $$$resolve$$$resolveconstQString&intconstchar* -->
<h3 class="fn"><a name="resolve-3"></a><span class="type">void</span> * QLibrary::<span class="name">resolve</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, <span class="type">int</span> <i>verNum</i>, const <span class="type">char</span> * <i>symbol</i> )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<p>Loads the library <i>fileName</i> with major version number <i>verNum</i> and returns the address of the exported symbol <i>symbol</i>. Note that <i>fileName</i> should not include the platform-specific file suffix; (see <a href="qlibrary.html#fileName-prop">fileName</a>). The library remains loaded until the application exits. <i>verNum</i> is ignored on Windows.</p>
<p>The function returns 0 if the symbol could not be resolved or if the library could not be loaded.</p>
<p>Note: In Symbian resolving with symbol names works only if the loaded library was built as STDDLL. Otherwise, the ordinals must be used.</p>
<p><b>See also </b><a href="qlibrary.html#resolve">resolve</a>().</p>
<!-- @@@resolve -->
<!-- $$$resolve$$$resolveconstQString&constQString&constchar* -->
<h3 class="fn"><a name="resolve-4"></a><span class="type">void</span> * QLibrary::<span class="name">resolve</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>version</i>, const <span class="type">char</span> * <i>symbol</i> )<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<p>Loads the library <i>fileName</i> with full version number <i>version</i> and returns the address of the exported symbol <i>symbol</i>. Note that <i>fileName</i> should not include the platform-specific file suffix; (see <a href="qlibrary.html#fileName-prop">fileName</a>). The library remains loaded until the application exits. <i>version</i> is ignored on Windows.</p>
<p>The function returns 0 if the symbol could not be resolved or if the library could not be loaded.</p>
<p>Note: In Symbian resolving with symbol names works only if the loaded library was built as STDDLL. Otherwise, the ordinals must be used.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qlibrary.html#resolve">resolve</a>().</p>
<!-- @@@resolve -->
<!-- $$$setFileNameAndVersion[overload1]$$$setFileNameAndVersionconstQString&int -->
<h3 class="fn"><a name="setFileNameAndVersion"></a><span class="type">void</span> QLibrary::<span class="name">setFileNameAndVersion</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, <span class="type">int</span> <i>versionNumber</i> )</h3>
<p>Sets the <a href="qlibrary.html#fileName-prop">fileName</a> property and major version number to <i>fileName</i> and <i>versionNumber</i> respectively. The <i>versionNumber</i> is ignored on Windows and Symbian.</p>
<p>Note: In Symbian the path portion of the <i>fileName</i> is ignored.</p>
<p><b>See also </b><a href="qlibrary.html#fileName-prop">setFileName</a>().</p>
<!-- @@@setFileNameAndVersion -->
<!-- $$$setFileNameAndVersion$$$setFileNameAndVersionconstQString&constQString& -->
<h3 class="fn"><a name="setFileNameAndVersion-2"></a><span class="type">void</span> QLibrary::<span class="name">setFileNameAndVersion</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>version</i> )</h3>
<p>Sets the <a href="qlibrary.html#fileName-prop">fileName</a> property and full version number to <i>fileName</i> and <i>version</i> respectively. The <i>version</i> parameter is ignored on Windows and Symbian.</p>
<p>Note: In Symbian the path portion of the <i>fileName</i> is ignored.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qlibrary.html#fileName-prop">setFileName</a>().</p>
<!-- @@@setFileNameAndVersion -->
<!-- $$$unload[overload1]$$$unload -->
<h3 class="fn"><a name="unload"></a><span class="type">bool</span> QLibrary::<span class="name">unload</span> ()</h3>
<p>Unloads the library and returns true if the library could be unloaded; otherwise returns false.</p>
<p>This happens automatically on application termination, so you shouldn't normally need to call this function.</p>
<p>If other instances of <a href="qlibrary.html">QLibrary</a> are using the same library, the call will fail, and unloading will only happen when every instance has called unload().</p>
<p>Note that on Mac OS X 10.3 (Panther), dynamic libraries cannot be unloaded.</p>
<p><b>See also </b><a href="qlibrary.html#resolve">resolve</a>() and <a href="qlibrary.html#load">load</a>().</p>
<!-- @@@unload -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>