QLibrary Class Reference |
Platform | Valid suffixes |
---|---|
Windows | .dll |
Unix/Linux | .so |
AIX | .a |
HP-UX | .sl |
Mac OS X | .dylib, .bundle, .so |
Trailing versioning numbers on Unix are ignored.
Returns true if the library is loaded; otherwise returns false.
See also load().
Loads the library and returns true if the library was loaded successfully; otherwise returns false. Since resolve() 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.
On Mac OS X this function uses code from dlcompat, part of the OpenDarwin project.
Copyright (c) 2002 Jorge Acereda and Peter O'Gorman.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See also unload().
Returns the address of the exported symbol symbol. 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.
Example:
typedef int (*AvgFunction)(int, int); AvgFunction avg = (AvgFunction) library->resolve("avg"); if (avg) return avg(5, 8); else return -1;
The symbol must be exported as a C function from the library. This means that the function must be wrapped in an extern "C" if the library is compiled with a C++ compiler. On Windows you must also explicitly export the function from the DLL using the __declspec(dllexport) compiler directive, for example:
extern "C" MY_EXPORT int avg(int a, int b) { return (a + b) / 2; }
with MY_EXPORT defined as
#ifdef Q_WS_WIN #define MY_EXPORT __declspec(dllexport) #else #define MY_EXPORT #endif
On Mac OS X this function uses code from dlcompat, part of the OpenDarwin project.
Copyright (c) 2002 Jorge Acereda and Peter O'Gorman.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This is an overloaded member function, provided for convenience.
Loads the library fileName and returns the address of the exported symbol symbol. Note that fileName should not include the platform-specific file suffix; (see fileName). The library remains loaded until the application exits.
The function returns 0 if the symbol could not be resolved or if the library could not be loaded.
See also resolve().
This is an overloaded member function, provided for convenience.
Loads the library fileName with major version number verNum and returns the address of the exported symbol symbol. Note that fileName should not include the platform-specific file suffix; (see fileName). The library remains loaded until the application exits.
The function returns 0 if the symbol could not be resolved or if the library could not be loaded.
See also resolve().
Sets the fileName property and major version number to fileName and versionNumber respectively.
See also setFileName().
Unloads the library and returns true if the library could be unloaded; otherwise returns false.
This happens automatically on application termination, so you shouldn't normally need to call this function.
If other instances of QLibrary are using the same library, the call will fail, and unloading will only happen when every instance has called unload().
Note that on Mac OS X, dynamic libraries cannot be unloaded.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.1 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com