Results 1 to 6 of 6

Thread: Developing Plugins

  1. #1
    Join Date
    Jan 2006
    Location
    Edmonton, Canada
    Posts
    101
    Thanks
    13
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Developing Plugins

    I have a couple of questions regarding Qt plugin development.

    1. Reading Qt's documentation of "How to Create Qt Plugins", the section describing the build key notes that "In cases where different versions of the same compiler do not produce binary compatible code, the version of the compiler is also present in the build key". Does anyone know how I can determine if different versions of compilers produce binary compatible code? I am by no means a C++ expert so I'm not exactly certain what this means even. I have written some Qt code compiled with MSVC 7 - will I be able to plugin components compiled with MSVC 8? What about other compilers?

    2. When defining an interface, the Q_DECLARE_INTERFACE() macro associates an identifier with an interface class name. In the Qt examples it seems that they include a version number in the identifier (e.g. "com.trolltech.PlugAndPaint.BrushInterface/1.0"). Is this version number used anywhere by Qt? If Qt finds two different versions of the same plugin, I would like to use the newer one, but I'm not sure if this is something Qt does automatically or if that's a behavour I have to code myself.

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Developing Plugins

    1. The build key is rarely a problem. Indeed if you distribute the source of your application, users are always able to compile both application and plugins without compatibility problems. Just the same way, if you distribute only binaries (as your use of MSVC might suggest), they will be compiled on your box and plugins and app will always have the same build key...
    2. AFAIK the plugin identifiers are not interpreted by Qt plugin loading code in any special way because its only purpose is to ensure the unicity of interfaces... Thus the version match must be done by hand... BTW I'm not even sure that the identifier can be retrieved at run time. Besides identifier are set for an interface not for an implementation and if the interface change the identifier should change as well because backward compatibility will be lost...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Developing Plugins

    Quote Originally Posted by Jimmy2775 View Post
    I have a couple of questions regarding Qt plugin development.

    1. Reading Qt's documentation of "How to Create Qt Plugins", the section describing the build key notes that "In cases where different versions of the same compiler do not produce binary compatible code, the version of the compiler is also present in the build key". Does anyone know how I can determine if different versions of compilers produce binary compatible code? I am by no means a C++ expert so I'm not exactly certain what this means even. I have written some Qt code compiled with MSVC 7 - will I be able to plugin components compiled with MSVC 8? What about other compilers?
    I would not worry too much about the buildkey. For example I was able to load a plugin built with gcc from an executable built with MSVC 8.

    Quote Originally Posted by Jimmy2775 View Post
    2. When defining an interface, the Q_DECLARE_INTERFACE() macro associates an identifier with an interface class name. In the Qt examples it seems that they include a version number in the identifier (e.g. "com.trolltech.PlugAndPaint.BrushInterface/1.0"). Is this version number used anywhere by Qt? If Qt finds two different versions of the same plugin, I would like to use the newer one, but I'm not sure if this is something Qt does automatically or if that's a behavour I have to code myself.

    Thank you.
    The identifier is used for deciding whether a plugin can be loaded or not. AFAIK there's no option for you to decide which version to load, Qt simply requires that the identifiers match.
    "If you lie to the compiler, it will get its revenge." - Henry Spencer

  4. #4
    Join Date
    Jan 2006
    Location
    Edmonton, Canada
    Posts
    101
    Thanks
    13
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Developing Plugins

    Quote Originally Posted by fullmetalcoder View Post
    Just the same way, if you distribute only binaries (as your use of MSVC might suggest), they will be compiled on your box and plugins and app will always have the same build key...
    Thanks for the info. My concern is with the fact that the app will be compiled on my machine, but it is possible for third-party developers to compile their own plugins for the app. I am trying to determine how much if a problem this could be if they're using a different compiler. Ideally I'd like to be able to provide documentation listing which compilers they could use to create compatible plugins. Is this something that is known, or do I have to try different compilers and see what works and what doesn't?

  5. #5
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Developing Plugins

    Quote Originally Posted by Jimmy2775 View Post
    Thanks for the info. My concern is with the fact that the app will be compiled on my machine, but it is possible for third-party developers to compile their own plugins for the app. I am trying to determine how much if a problem this could be if they're using a different compiler. Ideally I'd like to be able to provide documentation listing which compilers they could use to create compatible plugins. Is this something that is known, or do I have to try different compilers and see what works and what doesn't?
    Well basically the build platform already brings restriction and I think that, except some exceptions, binaries build on the same platform should be compatible especially if the use of external libraries (apart from Qt) is reduced...

    See :
    Quote Originally Posted by Methedrine
    For example I was able to load a plugin built with gcc from an executable built with MSVC 8.
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #6
    Join Date
    Jan 2006
    Location
    Edmonton, Canada
    Posts
    101
    Thanks
    13
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Developing Plugins

    Okay - I guess that makes sense. Let's see if I understand this right - If all my Windows code is compiled with MSVC8, most other Windows compilers should be able to compile compatible plugins, and likewise if I use Intel's C++ compiler for Mac, most other Mac compilers should create compatible plugins. If that's the case then that's good enough for me.

    Thanks fullmetalcoder and Methedrine for your help.

    Jimmy

Similar Threads

  1. Nightmares with plugins
    By KShots in forum Qt Programming
    Replies: 6
    Last Post: 8th February 2007, 16:46
  2. Qt plugins - how to do a libtool-style autoload
    By KShots in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2007, 12:40
  3. Arthur Plugins demos and designer
    By antonio.r.tome in forum Installation and Deployment
    Replies: 4
    Last Post: 21st March 2006, 14:01
  4. How to reload widget plugins?
    By victorng in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2006, 23:27
  5. Plugins as small application
    By blackliteon in forum Qt Programming
    Replies: 4
    Last Post: 12th January 2006, 09:39

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.