libzip: libzip-discuss: libzip and MXE/mingw: error with ZIP_EXTERN/dllimport


Thread Index


From: Sylvain <>
Subject: libzip and MXE/mingw: error with ZIP_EXTERN/dllimport
Date: Sun, 16 Dec 2012 21:41:36 +0000


I'm writing a MXE ( build script for libzip, which I
use in my GNU FreeDink project :)

(MXE is a cross-compilation helper for MinGW, which allow you to build
.dll and .exe from GNU/Linux.  I just send a patch for libzip support
here: )

I think that somewhere between 0.9.3 and 0.10.1, cross-compilation for
static builds stopped working.  When linking libzip it with my
program, I now get lots of "undefined reference to `_imp__zip_open'"
and such.

'gcc -E' tells me that functions in zip.h are prefixed with
__declspec(dllimport).  The section in zip.h about ZIP_EXTERN seems to
be the culprit.

Currently I made a quick&dirty patch in the MXE build script, but it
would be nice to fix this properly (that is, if I'm right in saying
that the problem is within libzip ;)).

When I meet this kind of issue, I can only recommend the Autotoold
"goat book" dedicated section at:
It deals with all the 5 use cases of declaring .dll symbols.

What do you think?


Made by MHonArc.