Changeset 64:7e6e914bc8f5 in SMSSender


Ignore:
Timestamp:
Feb 5, 2010 2:00:58 PM (9 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
3.0
Convert:
svn:3639001d-8e34-449c-bb86-3782b86c4877/branches/3.0@63
Message:
  • Loading the gateways with QLibrary. Hopefully, this works with a static build of QT.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gateways/SwisscomXtraZone/src/main.cpp

    r42 r64  
    77namespace SwisscomXtraZone {
    88
    9 /*ILibrary* Library::instance_ = NULL;
     9ILibrary* Library::instance_ = NULL;
    1010ILibrary* Library::instance() {
    1111    return instance_ ? instance_ : (instance_ = new Library);
    12 }*/
     12}
    1313
    1414
     
    2525}
    2626
    27 
     27extern "C" LIBRARY_EXPORT ILibrary* getLibrary() {
     28    return SwisscomXtraZone::Library::instance();
     29}
    2830/*extern "C" {
    2931    IMPORT_EXPORT
  • gateways/SwisscomXtraZone/src/main.h

    r42 r64  
    1212//#include <QtCore/QtGlobal>
    1313
    14 /*#if (defined(QT_DLL) || defined(QT_SHARED)) && !defined(QT_PLUGIN)
     14#if (defined(QT_DLL) || defined(QT_SHARED)) && !defined(QT_PLUGIN)
    1515#   define IMPORT_EXPORT Q_DECL_EXPORT
    1616#else
    1717#   define IMPORT_EXPORT Q_DECL_IMPORT
    18 #endif*/
     18#endif
    1919
    2020
     
    3030public:
    3131    Library(){}
    32 //    static ILibrary* instance();
     32    static ILibrary* instance();
    3333
    3434    virtual QTranslator* getTranslator(const QLocale& locale);
    3535    IGateway* getGateway() const;
    3636
    37 //protected:
    38 
    3937private:
    4038    Q_DISABLE_COPY(Library);
     39
     40    static ILibrary* instance_;
    4141};
    4242
  • lib/libinterfaces/src/business/ilibrary.h

    r41 r64  
    3333                     "ch.gorrion.smssender.ILibrary/1.0")
    3434
     35#ifdef Q_WS_WIN
     36#define LIBRARY_EXPORT __declspec(dllexport)
     37#else
     38#define LIBRARY_EXPORT
     39#endif
    3540
    3641#endif /* ILIBRARY_H_ */
  • src/business/BCLibraryLoader.cpp

    r40 r64  
    5151    }
    5252
    53     pluginLoader()->setLoadHints(QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint);
     53    QLibrary library;
     54    library.setLoadHints(QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint);
     55    library.setFileName(filename);
     56
     57    typedef ILibrary* (*GetLibraryFunc)();
     58    GetLibraryFunc getLibrary = (GetLibraryFunc)library.resolve("getLibrary");
     59    if (getLibrary) {
     60        ILibrary* lib = getLibrary();
     61        if (lib != NULL) {
     62            libraries_.insert(filename, lib);
     63            IGateway* gateway = lib->getGateway();
     64            if (gateway != NULL) {
     65                gateways_.insert(lib, gateway);
     66            }
     67
     68            return lib;
     69        }
     70    } else {
     71        qWarning() << "The library could not have been loaded: " + library.errorString();
     72        return NULL;
     73    }
     74
     75/*    pluginLoader()->setLoadHints(QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint);
    5476    pluginLoader()->setFileName(filename);
    5577    QObject* plugin = pluginLoader()->instance();
     
    6890        qWarning() << pluginLoader()->errorString();
    6991    }
    70     return NULL;
     92    return NULL;*/
    7193}
    7294
Note: See TracChangeset for help on using the changeset viewer.