[webkit-qt] Linking static custom plugins

Lindsay Mathieson lindsay.mathieson at gmail.com
Fri Apr 15 05:43:00 PDT 2011


I'm implementing a test QWebKitPlatformPlugin as a test and am
wondering if its possible to link it statically into an app rather
than creating a dynamic library. I get the following when trying:

In function `global constructors keyed to windowOptions':
main.cpp:(.text+0x4298): undefined reference to
`qt_plugin_instance_testqwebkitplatformplugin()'
collect2: ld returned 1 exit status
make[1]: *** [../bin/QtTestBrowser] Error 1


The code is as follows:


#include <QDebug>
#include <QtPlugin>
#include "qwebkitplatformplugin.h"

#define methodDebug() qDebug("QtTestBrowser: %s", __FUNCTION__);





class TestQWebKitPlatformPlugin :
    public QObject,
    public QWebKitPlatformPlugin
{
public:
    Q_OBJECT
    Q_INTERFACES(QWebKitPlatformPlugin)


public:
    TestQWebKitPlatformPlugin();
    bool supportsExtension(Extension extension) const;

    QObject* createExtension(Extension extension) const;
};

TestQWebKitPlatformPlugin::TestQWebKitPlatformPlugin()
{
}

bool TestQWebKitPlatformPlugin::supportsExtension(Extension extension) const
{
    qDebug() << "TestQWebKitPlatformPlugin::supportsExtension" << endl;
    return false;
}

QObject* TestQWebKitPlatformPlugin::createExtension(Extension extension) const
{
    qDebug() << "TestQWebKitPlatformPlugin::createExtension" << endl;
    return NULL;
}


Q_EXPORT_PLUGIN2(testqwebkitplatformplugin, TestQWebKitPlatformPlugin);


Q_IMPORT_PLUGIN(testqwebkitplatformplugin);






thanks,


-- 
Lindsay


More information about the webkit-qt mailing list