[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] w32 and Libtool.
From: |
Peter Rosin |
Subject: |
Re: [RFC] w32 and Libtool. |
Date: |
Thu, 14 Oct 2010 12:00:05 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 |
Hi Simon,
Thanks for the feedback.
Den 2010-10-14 09:34 skrev Simon Josefsson:
> First, thanks for working on this. It is definitely needed in the
> manual. I have re-engineered this a couple of times already, but the
> collected wisdom should be in the manual in the first place.
Indeed.
> Peter Rosin <address@hidden> writes:
>> #if defined _WIN32 && !defined __GNUC__
>> # ifdef BUILDING_LIBFOO
>> # ifdef DLL_EXPORT
>> # define LIBFOO_SCOPE extern __declspec (dllexport)
>> # endif
>> # elif defined _MSC_VER || defined DLL_EXPORT
>> # define LIBFOO_SCOPE extern __declspec (dllimport)
>> # endif
>> #endif
>> #ifndef LIBFOO_SCOPE
>> # define LIBFOO_SCOPE extern
>> #endif
>
> I think it would help to namespace clarify this, to make it clear which
> CPP symbols are from the system and which are intended to be provided by
> the project itself. How about this:
>
> #if defined _WIN32 && !defined __GNUC__
> # ifdef LIBFOO_BUILDING
> # ifdef LIBFOO_DLL_EXPORT
> # define LIBFOO_SCOPE extern __declspec (dllexport)
> # endif
> # elif defined _MSC_VER || defined LIBFOO_DLL_EXPORT
> # define LIBFOO_SCOPE extern __declspec (dllimport)
> # endif
> #endif
> #ifndef LIBFOO_SCOPE
> # define LIBFOO_SCOPE extern
> #endif
DLL_EXPORT comes from libtool, so it should not be changed to
LIBFOO_DLL_EXPORT. And while I approve of starting with LIBFOO_
instead of BUILDING_, LIBFOO_BUILDING sounds very wrong as
BUILDING changes from a verb to a noun. LIBFOO_BUILD perhaps?
Other suggestions welcome.
> However, I suspect people will need to adapt this block for their own
> projects.
Yes, I should have tested the code before I submitted the initial
version. When I tested the code, I realized I had forgotten a
couple of pretty important bits. An update is coming up.
> For comparison, in my projects I'm using a variant of this:
>
> # ifndef GSASL_API
> # if defined GSASL_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
> # define GSASL_API __attribute__((__visibility__("default")))
> # elif defined GSASL_BUILDING && defined _MSC_VER && ! defined GSASL_STATIC
> # define GSASL_API __declspec(dllexport)
> # elif defined _MSC_VER && ! defined GSASL_STATIC
> # define GSASL_API __declspec(dllimport)
> # else
> # define GSASL_API
> # endif
> # endif
I'm desperately trying to get away from having to specify (the
equivalence of) GSASL_STATIC when consuming libraries.
Cheers,
Peter
- [RFC] w32 and Libtool., Peter Rosin, 2010/10/13
- Re: [RFC] w32 and Libtool., Vincent Torri, 2010/10/13
- Re: [RFC] w32 and Libtool., Ralf Wildenhues, 2010/10/13
- Re: [RFC] w32 and Libtool., Peter Rosin, 2010/10/13
- Re: [RFC] w32 and Libtool., Ralf Wildenhues, 2010/10/14
- Re: [RFC] w32 and Libtool., Simon Josefsson, 2010/10/14
- Re: [RFC] w32 and Libtool.,
Peter Rosin <=
- Re: [RFC] w32 and Libtool., Simon Josefsson, 2010/10/14
- Re: [RFC] w32 and Libtool., Peter Rosin, 2010/10/14
- Re: [RFC] w32 and Libtool., Simon Josefsson, 2010/10/14
Re: [RFC] w32 and Libtool., Peter Rosin, 2010/10/14