Re: ustring and multithread
- From: "Fabian Jacquet" <fabian jacquet gmail com>
- To: "Murray Cumming" <murrayc murrayc com>
- Cc: gtkmm-list gnome org
- Subject: Re: ustring and multithread
- Date: Wed, 18 Jun 2008 15:16:09 +0200
Hi,
I'm trying to recompile glib and I have this error:
G:\libxml++\glib 2.12\glib\glib>nmake -f makefile.msc
Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
cl -G5 -GF -MD -W3 -nologo -Ox -Zd -FImsvc_recommended_pragmas.h -I . -I
.. -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=\"GLib\" -DG_ENABLE_DEBUG
-Zm400 -I ..\../gettext-0.10.40/intl -I ..\../libiconv-1.7\include -I ..\..\glib
\build\win32\dirent -LD -Felibglib-2.0-0.dll garray.obj gasyncqueue.obj
gatomic.obj gbacktrace.obj gbase64.obj gbookma
rkfile.obj gcache.obj gcompletion.obj gconver
t.obj gdataset.obj gdate.obj gdir.obj
gerror.obj gfileutils.obj ghash.obj ghook.o
bj gkeyfile.obj gmappedfile.obj giochannel.obj
giowin32.obj glist.obj gmain.obj
gmarkup.obj gmem.obj gmessages.obj gnode.o
bj goption.obj gprimes.obj gqsort.obj
gqueue.obj gpattern.obj gprintf.obj grand.obj
grel.obj gscanner.obj gshell.obj gslice.
obj gslist.obj gspawn-win32.obj gstdio.obj gstrfun
cs.obj gstring.obj gthread.obj gthreadpool.obj
gtimer.obj gtree.obj gunibreak.obj
gunicollate.obj gunidecomp.obj guniprop.obj
gutf8.obj gutils.obj gwin32.obj
localcharset.obj glib.res ..\../libiconv-1.7\lib\iconv.lib ..\../gettext-0.10.4
0/intl\intl.lib gnulib\gnulib.lib ..\..\glib\build\win32\dirent\dirent.lib user
32.lib advapi32.lib shell32.lib wsock32.lib ole32.lib ws2_32.lib /link /machine
:ix86 /implib:glib-2.0.lib /def:glib.def
cl : Command line warning D9002 : ignoring unknown option '-G5'
cl : Command line warning D9002 : ignoring unknown option '-Zd'
glib.def(112) : fatal error LNK1118: syntax error in 'G_GNUC_MALLOC' statement
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\c
l.EXE"' : return code '0x2'
Stop.
Can somebody help me?
2008/6/17 Fabian Jacquet <
fabian jacquet gmail com>:
Or the dll I use are not compiled for VS8 runtime like my program...
Ok, I understand what you say about mixing runtimes.
2008/6/17 Fabian Jacquet <
fabian jacquet gmail com>:
:-) It's of course different strings. And I effectively use Windows :-D
Glib::ustring uses glib which is C library so It must share some context. Is it possible my binary of glib is not thread safe?
2008/6/17 Murray Cumming <
murrayc murrayc com>:
On Tue, 2008-06-17 at 15:24 +0200, Fabian Jacquet wrote:
> Hi all,
>
> I don't know if it's the good mailing list for this question. Sorry if
> it's not.
>
> I use libxml++ which depend on glibmm-2.4.dll on
2.12.7.1 version.
> libxml++ writes UTF8 so it use Glib::ustring.
> My program uses a lot of threads traiting xml and some time I have an
> "Access violation" error.
> It seams this error occurs on the operator== of the ustring...
> It's simply reproducible with this code in threads:
>
> Glib::ustring myString = "azerty";
> if(myString == "qsdfgh")
> ...
>
> I don't have any problem if I cast ustring in std::string before
> compare.
> Is there another solution?
Neither std::string or Glib::ustring are thread safe. You need to
protect access to them with a mutex if you are using the same strings
from multiple threads.
If you are not accessing the same strings from multiple threads then you
have some other problem. It sounds like you are using Windows, so maybe
you are mixing runtimes?
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]