On Fri, Jun 19, 2015 at 1:42 PM, Lasse Collin <lasse.col...@tukaani.org> wrote:
> ...
> My understanding is that the symbols exported from a DLL should be
> marked with __declspec(dllexport) when building the DLL. When built with
> MinGW-w64, this is done in src/liblzma/common/common.h by checking if
> DLL_EXPORT has been defined by Libtool. Does this work with MSVC as is
> or does this need to be fixed?

My apologies, DLL_EXPORT must indeed be set for the dll to generate the lib.

I attached a git diff that does this.

>
> The API header src/liblzma/api/lzma.h detects MSVC by checking if
> _MSC_VER has been defined and avoids using <inttypes.h> because before
> MSVC 2013 it didn't exist (I think). Is it OK to replace the line 90
>
>     #if defined(_WIN32) && defined(_MSC_VER)
>
> with this?
>
>     #if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1800
>
> It doesn't matter when building liblzma itself, but it can matter when
> compiling something that uses the liblzma API.
>

I believe this is safe; it still builds and runs fine for me with this change,
even with consumers of the DLL built before the DLL was rebuilt, and vice
versa. In the end it is simply a bunch of typedefs to the same POD type,
so I believe this is a safe change

-- 

- Adam D. Walling

Attachment: xz_dll_export.patch
Description: Binary data

Reply via email to