bug-libunistring
[Top][All Lists]
Advanced

[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: Thu, 28 May 2009 16:48:53 -0700

> Cross-compiling on a Debian machine using mingw is simple
> these days.  I build several projects using a simple
> Makefile, it is all on <http://josefsson.org/gnutls4win/>.
> If you have wine installed, it will even run the
> self-tests for you.

I'd like to do this all on a windows box if possible, but ignoring that for
a bit the section

"Using the GnuTLS DLL from your Visual Studio program"

describes what I'll need to do to link with the mingw-built DLLs.
Unfortunately I'm not quite that far along yet since I'm running into
compiler errors due to missing include files.  At least that's my
understanding of things at the moment.

For what it's worth, commenting out the #include <stdint.h> and #include
<inttypes.h> from unistring/stdint.h gets me by the compiler errors.
Surrounding those statements with something like #ifndef MSC_VER would
probably let those files work with both mingw and MSVC.

I also need to deal with stdbool.h being missing.  For now

typedef int bool;

in place of

#include <stdbool.h> in unistring/stdbool.h gets me further down the road.
I'm curious what people see as more permanent solutions for this.

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.  More specifically, an assert fires in the Debug
configuration that the pointer I'm trying to free is invalid.  Again, not
really a surprise.  Linking with libunistring.dll.a is probably wrong.

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.  I tried a couple of different invocations of dlltool
(e.g. dlltool --export-all-symbols --output-exp libunistring-0.exp
--output-lib libunistring-0.lib libunistring-0.dll) but get no luck linking
against libunistring-0.lib.

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 but
barring that I could use some more specific info on how to modify
http://josefsson.org/gnutls4win for libiconv/libunistring or other
suggestions on linking mingw-built libunistring with MSVC and MSVC-compiled
code.

Thanks much.

-DB





reply via email to

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