Results 1 to 9 of 9

Thread: How to export resources in libraries on LINUX using Qt????

  1. #1
    Join Date
    Dec 2006
    Posts
    103
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Question How to export resources in libraries on LINUX using Qt????

    Hi all,
    I want to export the resources available in a Qt project from library (DLL) to application on LINUX platform.
    Has anyone done it earlier or any one know about it because I am not able to find any relevant information on how to export resources from library to application on LINUX platform.
    I am using Qt 4.2.2 and SUSE.
    Thanks
    Shuchi
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to export resources in libraries on LINUX using Qt????

    See the documentation for Q_INIT_RESOURCE and Q_CLEANUP_RESOURCE.

    Regards

  3. The following user says thank you to marcel for this useful post:

    Shuchi Agrawal (29th May 2007)

  4. #3
    Join Date
    Dec 2006
    Posts
    103
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: How to export resources in libraries on LINUX using Qt????

    Quote Originally Posted by marcel View Post
    See the documentation for Q_INIT_RESOURCE and Q_CLEANUP_RESOURCE.

    Regards
    Hi marcel, thanks a lot. the information you gave me was very useful but still my problem lies the same as how can we embedd the resource in a DLL or library and how can i use it in the application. qmake creates a .cpp file from .qrc file. so how to export the content of this .cpp file to the application. In the application, while using the resource we need to give the path of the resource but if the resourec is in the dll then how will we give the path to the resource.
    Thanks
    Shuchi
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

  5. #4
    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: How to export resources in libraries on LINUX using Qt????

    Your question is really strange... It's like you asked "if we export a function in a library, how do we know what are the names of exported functions". You can release some documentation listing the resources and their paths Or you can use QDir and QFile to iterate over the virtual filesystem. Or you can have a method in the library that will return a list or tree of resource paths. Or you can implement it any other way you want.

  6. The following user says thank you to wysota for this useful post:

    Shuchi Agrawal (29th May 2007)

  7. #5
    Join Date
    Dec 2006
    Posts
    103
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to export resources in libraries on LINUX using Qt????

    hi,
    i have a .qrc file in the dll that is loaded using Q_INIT_RESOURCE(resource file name).This is called in a function xyz() in dll. this function xyz() is exported.Now in application, this function is called and tis is how resources are exported.
    Can anuone tell me any other way to export the resouces.Like either an entry point function which i can use instead of xyz() or direclty writing a macro to export resources in .qrc file so they can be directly used by their name in application.
    Please refer to any links or sample codes if possible.
    I will be greatful to you.
    Thanks
    Shuchi
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

  8. #6
    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: How to export resources in libraries on LINUX using Qt????

    I'm afraid I don't understand the question... You want to call something else than Q_INIT_RESOURCE to do the same the macro does? Why?

  9. #7
    Join Date
    Dec 2006
    Posts
    103
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to export resources in libraries on LINUX using Qt????

    Quote Originally Posted by wysota View Post
    I'm afraid I don't understand the question... You want to call something else than Q_INIT_RESOURCE to do the same the macro does? Why?
    Because i am calling this macro from a function in dll and this function is exported.So is there any way like entry point function so that i can call this macro in that rather than simply defining a function in dll, export it and then call it from application.
    Thanks
    Shuchi
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

  10. #8
    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: How to export resources in libraries on LINUX using Qt????

    I think this is platform/compiler dependent (try init() or _init()). But I think that if it was easy to do that, Trolltech would have done that in the first place...

  11. #9
    Join Date
    Dec 2006
    Posts
    103
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to export resources in libraries on LINUX using Qt????

    Quote Originally Posted by wysota View Post
    I think this is platform/compiler dependent (try init() or _init()). But I think that if it was easy to do that, Trolltech would have done that in the first place...
    Yes you are right that if it was easy to do that, Trolltech would have done that in the first place... Thanks a lot for all the replies to everyone
    I worked on windows Xp with Qt 4.2.2(Open Source Version) and MinGw
    now i am trying the same things on Fedora Core 5 (linux-gcc) and Qt 4.2.2 open source edition.

Similar Threads

  1. Qt 3.3 libraries
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2006, 17:25

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.