[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-libunistring] mixing MSVC and mingw-built libunistring

From: Bruno Haible
Subject: Re: [bug-libunistring] mixing MSVC and mingw-built libunistring
Date: Fri, 29 May 2009 13:30:33 +0200
User-agent: KMail/1.9.9


David Byron wrote:
> I'm trying to link libunistring with other code compiled with MSVC ...

> I'm getting an error from within unistring/stdint.h: 
> 1>c:\utils\cygwin\usr\local\mingw\include\unistring/stdint.h(56) : fatal
> error C1083: Cannot open include file: 'stdint.h': No such file or directory
> My version of MSVC (2005 aka 8) doesn't provide stdint.h.

Indeed, the installed files unistring/stdint.h and unistring/stdbool.h depend
on the compiler being used. This is bad practice. I'll what I can do about

> Before I went down the path of building libiconv and libunistring with mingw
> I tried building them with the MSVC tools (and a wrapper ala
> http://cccl.sourceforge.net/, but pretty heavily modified). I have a 
> feeling I need to spend more with this approach ...

Such wrappers a la cccl could work if they were correctly supported by libtool.
Currently no one is investing much energy into this approach as long as
  1) there are multiple versions of this cccl wrapper, not a single, standard 
  2) linking with MSVC introduces dependencies towards DLLs from Microsoft which
     are not present on pristine Windows XP systems; the GPL does not allow to
     ship these DLLs in the same installer package as a GPLed program. In other
     words, you get packaging problems.

> Once by the compiler errors, I added (the windows version of)
> /usr/local/mingw/lib to my linker path and linked in libunistring.dll.a.  I
> see a linker warning:
> 1>libunistring.dll.a(d000411.o) : warning LNK4078: multiple '.text' sections
> found with different attributes (E0300020)
> but I get an executable that runs.  Unfortunately it's busted.  This code:
>     uni_str = u8_strconv_from_locale("foo");
>     if (uni_str)
>     {
>         free(uni_str);
>     }
> crashes in free.

You know about the 3 runtime libraries in MSVC? See also
If you are packing a different runtime library than the one with which
libunistring was built, libunistring will use malloc from one runtime DLL
and you will call free from another runtime DLL. The memory pools are
disjoint -> free() crashes.

> I took a look through your Makefile but I don't see anything that creates
> the .def files that 
> "Using the GnuTLS DLL from your Visual Studio program"
> mentions.  This makes me think libtool does it but I don't see any .def
> files in libunistring.

The documentation that Simon wrote in gnulib/doc/ld-output-def.texi also
mentions a recipe in <http://support.microsoft.com/kb/131313/en-us>. It
should apply, because libunitring consists only of C API. Can you try that?

> Sorry to be slightly all over the place here.  I may be able to make my cccl
> script smart enough to get libiconv and libunistring to build using MSVC

While you can do that, I will not spend time on supporting this, as long
as everyone is using a different cccl-like wrapper.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]