Qt-interest Archive, October 2006
Using Qt in shared library
Pages: Prev | 1 | 2 | 3 | Next
Message 1 in thread
Hello,
I'm trying to create a shared library that uses some non GUI related
functionality(sql classes) of Qt. Everything compiles and runs fine
but when i try to use my shared library with application that uses Qt
itself conflicts arise. Like when using qInstallMsgHandler() or
QTextCodec::setCodecForCStrings(), when setting codec in shared
library the codec in application changes. I tried compiling shared
library with static Qt and application with shared Qt and vice versa
but same results. All this happens under linux, with Qt 3.3.4 and GCC
3.3.6.
I will appreciate any input,
Silver
--
[ signature omitted ]
Message 2 in thread
Hi,
> [...]
> library the codec in application changes. I tried compiling shared
> library with static Qt and application with shared Qt and vice versa
> but same results. All this happens under linux, with Qt 3.3.4 and GCC
> 3.3.6.
You need to use the very same *shared* Qt library for both your shared
library and the application.
Using a static Qt library won't work because of duplicate symbols.
--
[ signature omitted ]
Message 3 in thread
Hi,
Nope, unfortunately it doesn't work. If i ldd both my shared library
and application then i see that they both use libqt-mt.so from the
same location.
I'm quite puzzled because i thought that on windows and on linux the
shared libraries work the same way. I'm saying this because on windows
i saw no such problems.
On 10/16/06, Dimitri <dimitri@xxxxxxxxxxxxx> wrote:
> Hi,
>
> > [...]
> > library the codec in application changes. I tried compiling shared
> > library with static Qt and application with shared Qt and vice versa
> > but same results. All this happens under linux, with Qt 3.3.4 and GCC
> > 3.3.6.
>
> You need to use the very same *shared* Qt library for both your shared
> library and the application.
>
> Using a static Qt library won't work because of duplicate symbols.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 4 in thread
Silver AabjÃe wrote:
> Hi,
> ...
> I'm quite puzzled because i thought that on windows and on linux the
> shared libraries work the same way. I'm saying this because on windows
> i saw no such problems.
They work (more or less) the same way on win32 and Unix/Linux, but the
search strategy is somewhat different.
win32 searches in the application directory first, then in the PATH,
whereas on Unix/Linux libraries are searched according to different
criteria: the LD_LIBRARY_PATH (SHLIB_PATH on some Unix) and the "runtime
path", compiled into the exectuable (-rpath linker option I think).
Also on win32 you need to explicitly export your desired symbols from
the DLL, but I guess you already have that figured out, since your DLL
on Windows seems to work...
Cheers, Oliver
--
[ signature omitted ]
Message 5 in thread
Hi,
> Nope, unfortunately it doesn't work. If i ldd both my shared library
How doesn't it work?
I'm surprised it doesn't work because that's the way it's always done...
> and application then i see that they both use libqt-mt.so from the
> same location.
Indeed. Why is this a problem?
> I'm quite puzzled because i thought that on windows and on linux the
> shared libraries work the same way. I'm saying this because on windows
> i saw no such problems.
Mmmh... What's the exact problem? I can see no problem here.
--
[ signature omitted ]
Message 6 in thread
The problem is how to build my shared library so that an application
that uses Qt would not be interfered with my library's actions(ie
assigning a default database connection or a default codec)
SIlver
On 10/17/06, Dimitri <dimitri@xxxxxxxxxxxxx> wrote:
> Hi,
>
> > Nope, unfortunately it doesn't work. If i ldd both my shared library
>
> How doesn't it work?
>
> I'm surprised it doesn't work because that's the way it's always done...
>
> > and application then i see that they both use libqt-mt.so from the
> > same location.
>
> Indeed. Why is this a problem?
>
> > I'm quite puzzled because i thought that on windows and on linux the
> > shared libraries work the same way. I'm saying this because on windows
> > i saw no such problems.
>
> Mmmh... What's the exact problem? I can see no problem here.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 7 in thread
Hi,
> The problem is how to build my shared library so that an application
> that uses Qt would not be interfered with my library's actions(ie
> assigning a default database connection or a default codec)
I'm not sure what you mean by an application using Qt not interfering
with your library's actions. If they're in the same program, they'll see
the same event loop for example.
--
[ signature omitted ]
Message 8 in thread
Hi,
>If they're in the same program, they'll see the same event loop for example.
But i wan to avoid this. I want my shared library to act like dll
under windows. Under windows shared library acts more like an
application. But under Linux shared library is more like a static
library.
Silver
On 10/19/06, Dimitri <dimitri@xxxxxxxxxxxxx> wrote:
> Hi,
>
> > The problem is how to build my shared library so that an application
> > that uses Qt would not be interfered with my library's actions(ie
> > assigning a default database connection or a default codec)
>
> I'm not sure what you mean by an application using Qt not interfering
> with your library's actions. If they're in the same program, they'll see
> the same event loop for example.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 9 in thread
Hi,
>> If they're in the same program, they'll see the same event loop for
>> example.
>
> But i wan to avoid this. I want my shared library to act like dll
> under windows. Under windows shared library acts more like an
> application. But under Linux shared library is more like a static
> library.
I don't see how you can avoid this event loop issue. It's unrelated
whether you're using static libraries or DLLs.
--
[ signature omitted ]
Message 10 in thread
Hi,
I'm not sure if i have avoided the loop issue, but i don't have the
problems i described in my first post.
But if you have app and shared lib so that in app and shared lib
QApplication is created then you get a warning even if you link
dynamically the shared lib and qt, or am i mistaken?
On 10/19/06, Dimitri <dimitri@xxxxxxxxxxxxx> wrote:
> Hi,
>
> >> If they're in the same program, they'll see the same event loop for
> >> example.
> >
> > But i wan to avoid this. I want my shared library to act like dll
> > under windows. Under windows shared library acts more like an
> > application. But under Linux shared library is more like a static
> > library.
>
> I don't see how you can avoid this event loop issue. It's unrelated
> whether you're using static libraries or DLLs.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 11 in thread
Hi,
> But if you have app and shared lib so that in app and shared lib
> QApplication is created then you get a warning even if you link
> dynamically the shared lib and qt, or am i mistaken?
No, you shouldn't get any warning if the application and the shared
library are linked dynamically to a shared Qt library.
--
[ signature omitted ]
Message 12 in thread
I'm having trouble believing this. Could you please construct an example?
Cheers,
Silver
On 10/20/06, Dimitri <dimitri@xxxxxxxxxxxxx> wrote:
> Hi,
>
> > But if you have app and shared lib so that in app and shared lib
> > QApplication is created then you get a warning even if you link
> > dynamically the shared lib and qt, or am i mistaken?
>
> No, you shouldn't get any warning if the application and the shared
> library are linked dynamically to a shared Qt library.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 13 in thread
Hi,
> I'm having trouble believing this. Could you please construct an example?
Well... Try by yourself ;-)
--
[ signature omitted ]
Message 14 in thread
Hi,
>> But if you have app and shared lib so that in app and shared lib
>> QApplication is created then you get a warning even if you link
>> dynamically the shared lib and qt, or am i mistaken?
>
> No, you shouldn't get any warning if the application and the shared
> library are linked dynamically to a shared Qt library.
I meant to say that you shouldn't get a link-time warning. Nothing in
the linker prevents you from instantiating two different QApplications
in an app and a lib.
The question is how the whole thing behaves at run-time. Whatever the
combination of shared and static libraries, instantiating two
QApplications in the same executable doesn't work.
--
[ signature omitted ]
Message 15 in thread
Hi,
I dont get a warning during linking but a warning at run time.
On 10/24/06, Dimitri <dimitri@xxxxxxxxxxxxx> wrote:
> Hi,
>
> >> But if you have app and shared lib so that in app and shared lib
> >> QApplication is created then you get a warning even if you link
> >> dynamically the shared lib and qt, or am i mistaken?
> >
> > No, you shouldn't get any warning if the application and the shared
> > library are linked dynamically to a shared Qt library.
>
> I meant to say that you shouldn't get a link-time warning. Nothing in
> the linker prevents you from instantiating two different QApplications
> in an app and a lib.
>
> The question is how the whole thing behaves at run-time. Whatever the
> combination of shared and static libraries, instantiating two
> QApplications in the same executable doesn't work.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Pages: Prev | 1 | 2 | 3 | Next