[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: |
David Byron |
Subject: |
RE: [bug-libunistring] mixing MSVC and mingw-built libunistring |
Date: |
Fri, 29 May 2009 08:01:42 -0700 |
> 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 it.
Thank you.
> You know about the 3 runtime libraries in MSVC?
I do.
> See also
> <http://www.gnu.org/software/gettext/FAQ.html#windows_howto>
>From this it appears there are pre-built binaries for at least libiconv with
-MD. My MSVC code uses -MD for production but -MDd for debug so it appears
I still need to build both libiconv and libunistring with my own two hands
to get -MDd support.
> 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 understand. What I'm less clear on is how to deal with it.
http://msdn.microsoft.com/en-us/library/ms235460(VS.80).aspx discusses this
but doesn't suggest a solution.
> 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?
It works. I tried this before I wrote but I must have only tried with the
Debug configuration (-MDd), not Release (-MD). Here's what I did.
$ cd /usr/local/mingw/bin
$ echo EXPORTS >libunistring-0.def
$ dumpbin /EXPORTS libunistring-0.dll | tail -n+20 | awk '{ print $4 }'
>>libunistring-0.def
$ lib /def:libunistring-0.def
which created libunistring-0.exp and libunistring-0.lib
Then I add libunistring-0.lib to linker input and set the linker path to
include (the windows version of) /usr/local/mingw/bin and I get no more
linker warnings.
The Debug configuration (using -MDd) crashes in free as before but the
Release configuration (using -MD) works, at least with the few functions I'm
calling so far.
So close. Any ideas on either convincing me I don't need -MDd versions of
libiconv/libunistring or how to build them? I realize it's not OK to
distribute binaries built with -MDd since plain windows machines (w/o the MS
dev tools installed) don't have them. They're a big help to develop with
though.
> > 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.
Really what I think this means is trying out the pr-msvc-support branch of
libtool, though I'm guessing here. I'm tired of hacking on cccl as well.
Thanks again.
-DB