PDA

View Full Version : How to export resources in libraries on LINUX using Qt????



Shuchi Agrawal
28th May 2007, 07:42
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

marcel
28th May 2007, 08:10
See the documentation for Q_INIT_RESOURCE and Q_CLEANUP_RESOURCE.

Regards

Shuchi Agrawal
29th May 2007, 08:33
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

wysota
29th May 2007, 09:36
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.

Shuchi Agrawal
31st May 2007, 10:12
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

wysota
31st May 2007, 11:01
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?

Shuchi Agrawal
1st June 2007, 10:13
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

wysota
1st June 2007, 10:36
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...

Shuchi Agrawal
1st June 2007, 11:14
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 :)