Results 1 to 3 of 3

Thread: Qt plugins - how to do a libtool-style autoload

  1. #1
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Qt plugins - how to do a libtool-style autoload

    Hello all,

    I was hoping to create a project in which I would make use of plugins to implement much of the functionality of the finished project. Unfortunately, from what I've been reading in the documentation, QPluginLoader does not support automatically searching a given directory for plugins and loading them (similar to the libtool function lt_dlforeachfile(const char * search_path, int (*func) (const char * filename, lt_ptr data), lt_ptr data). In other words, I want to be able to load all plugins in a given folder, and I don't want to have to write a custom plugin finder that works for all conceivable architectures with all conceivable plugin extension names (.dll, .so, and likely another 10 or so possibilities).

    Is Qt capable of this, or should I just bite the bullet and find some way of using libtool?
    Life without passion is death in disguise

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt plugins - how to do a libtool-style autoload

    Oh come on...
    Qt Code:
    1. #ifdef Q_WS_WIN
    2. # define PLUG_EXT "*.dll"
    3. #elif defined Q_WS_MAC
    4. # define PLUG_EXT "*.dylib"
    5. #else
    6. # define PLUG_EXT "*.so"
    7. #endif
    8.  
    9. QDir d = QDir::current();
    10. QStringList pluginlist = d.entryList(PLUG_EXT, QDir::Files|QDir::Readable);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Qt plugins - how to do a libtool-style autoload

    Is that really all the options available? I know that covers linux, *BSD, Solaris, Mac, and Windows (I have access to these machines), but what about the more exotic OS's? I may be way wrong here, but aren't there other extensions?
    Life without passion is death in disguise

Similar Threads

  1. Qt4 Plugins How-to
    By Chaid in forum Qt Programming
    Replies: 4
    Last Post: 8th July 2006, 08:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.