libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] w32 and Libtool.


From: Simon Josefsson
Subject: Re: [RFC] w32 and Libtool.
Date: Thu, 14 Oct 2010 09:34:01 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

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.

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

However, I suspect people will need to adapt this block for their own
projects.

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

/Simon



reply via email to

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