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 <p...@lysator.liu.se> 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

_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to