You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2008/02/22 19:18:32 UTC

Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/

faridz@apache.org wrote:
> Author: faridz
> Date: Wed Feb 13 19:36:51 2008
> New Revision: 627648
> 
> URL: http://svn.apache.org/viewvc?rev=627648&view=rev
> Log:
> 2008-02-14  Farid Zaripov  <fa...@epam.com>
> 
> 	* include/rw/_defs.h: #define new macro _RWSTD_TI_EXPORT
> 	to prevent MSVC warning C4910: "'__declspec(dllexport)'
> 	and 'extern' are incompatible on an explicit instantiation".

I'm not sure I understand the problem. Is it because we declare
some explicit template instantiations when building the library
as

   extern template __declspec(dllexport) void foo<int>();

Why does this happen, and doesn't the problem affect ordinary
classes or functions as well? I.e., wouldn't either of the two
declarations below be a problem?

   extern __declspec(dllexport) void foo();
   __declspec(dllexport) void foo();

Or do we not have any such declarations in our code?

I ask because I'd like us to keep the number of special-purpose
macros to a minimum.

Martin


> 	* include/fstream: Use _RWSTD_TI_EXPORT instead of
> 	_RWSTD_EXPORT on an explicit instantiations.
> 	* include/istream: Ditto.
> 	* include/loc/_messages.h: Ditto.
> 	* include/loc/_money_get.h: Ditto.
> 	* include/loc/_money_put.h: Ditto.
> 	* include/loc/_moneypunct.h: Ditto.
> 	* include/loc/_num_get.h: Ditto.
> 	* include/loc/_num_put.h: Ditto.
> 	* include/loc/_numpunct.h: Ditto.
> 	* include/loc/_punct.h: Ditto.
> 	* include/loc/_time_get.h: Ditto.
> 	* include/loc/_time_put.h: Ditto.
> 	* include/ostream: Ditto.
> 	* include/rw/_basic_ios.h: Ditto.
> 	* include/rw/_ioinsert.h: Ditto.
> 	* include/rw/_mutex.h: Ditto.
> 	* include/sstream: Ditto.
> 	* include/streambuf: Ditto.
> 	* include/string: Ditto.
> 
> Modified:
>     stdcxx/trunk/include/fstream
>     stdcxx/trunk/include/istream
>     stdcxx/trunk/include/loc/_messages.h
>     stdcxx/trunk/include/loc/_money_get.h
>     stdcxx/trunk/include/loc/_money_put.h
>     stdcxx/trunk/include/loc/_moneypunct.h
>     stdcxx/trunk/include/loc/_num_get.h
>     stdcxx/trunk/include/loc/_num_put.h
>     stdcxx/trunk/include/loc/_numpunct.h
>     stdcxx/trunk/include/loc/_punct.h
>     stdcxx/trunk/include/loc/_time_get.h
>     stdcxx/trunk/include/loc/_time_put.h
>     stdcxx/trunk/include/ostream
>     stdcxx/trunk/include/rw/_basic_ios.h
>     stdcxx/trunk/include/rw/_defs.h
>     stdcxx/trunk/include/rw/_ioinsert.h
>     stdcxx/trunk/include/rw/_mutex.h
>     stdcxx/trunk/include/sstream
>     stdcxx/trunk/include/streambuf
>     stdcxx/trunk/include/string
> 
> Modified: stdcxx/trunk/include/fstream
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/fstream?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/fstream (original)
> +++ stdcxx/trunk/include/fstream Wed Feb 13 19:36:51 2008
> @@ -671,7 +671,7 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _CHAR)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_filebuf<char, char_traits<char> >);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _CHAR)
> @@ -679,7 +679,7 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_filebuf<wchar_t, char_traits<wchar_t> >);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_FILEBUF, _WCHAR_T)
> 
> Modified: stdcxx/trunk/include/istream
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/istream?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/istream (original)
> +++ stdcxx/trunk/include/istream Wed Feb 13 19:36:51 2008
> @@ -567,26 +567,26 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _CHAR)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_istream<char, char_traits<char> >);
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT istream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT istream&
>                            operator>> (istream&, string&));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT istream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT istream&
>                            getline (istream&, string&, char));
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_istream<wchar_t, char_traits<wchar_t> >);
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT wistream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT wistream&
>                            operator>> (wistream&, wstring&));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT wistream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT wistream&
>                            getline (wistream&, wstring&, wchar_t));
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_messages.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_messages.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_messages.h (original)
> +++ stdcxx/trunk/include/loc/_messages.h Wed Feb 13 19:36:51 2008
> @@ -150,13 +150,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_MESSAGES, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT messages<char>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT messages<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MESSAGES, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_MESSAGES, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT messages<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT messages<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MESSAGES, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_money_get.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_money_get.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_money_get.h (original)
> +++ stdcxx/trunk/include/loc/_money_get.h Wed Feb 13 19:36:51 2008
> @@ -134,13 +134,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_MONEY_GET, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT money_get<char>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_get<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MONEY_GET, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_MONEY_GET, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT money_get<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_get<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MONEY_GET, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_money_put.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_money_put.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_money_put.h (original)
> +++ stdcxx/trunk/include/loc/_money_put.h Wed Feb 13 19:36:51 2008
> @@ -120,13 +120,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_MONEY_PUT, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT money_put<char>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_put<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MONEY_PUT, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_MONEY_PUT, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT money_put<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT money_put<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MONEY_PUT, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_moneypunct.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_moneypunct.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_moneypunct.h (original)
> +++ stdcxx/trunk/include/loc/_moneypunct.h Wed Feb 13 19:36:51 2008
> @@ -226,15 +226,15 @@
>  
>  #if _RWSTD_INSTANTIATE (_MONEYPUNCT, _CHAR)
>  
> -_RWSTD_INSTANTIATE_2 (struct _RWSTD_EXPORT moneypunct<char, true>);
> -_RWSTD_INSTANTIATE_2 (struct _RWSTD_EXPORT moneypunct<char, false>);
> +_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<char, true>);
> +_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<char, false>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MONEYPUNCT, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_MONEYPUNCT, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_2 (struct _RWSTD_EXPORT moneypunct<wchar_t, true>);
> -_RWSTD_INSTANTIATE_2 (struct _RWSTD_EXPORT moneypunct<wchar_t, false>);
> +_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<wchar_t, true>);
> +_RWSTD_INSTANTIATE_2 (struct _RWSTD_TI_EXPORT moneypunct<wchar_t, false>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_MONEYPUNCT, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_num_get.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_num_get.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_num_get.h (original)
> +++ stdcxx/trunk/include/loc/_num_get.h Wed Feb 13 19:36:51 2008
> @@ -268,13 +268,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_NUM_GET, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT num_get<char>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_get<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_NUM_GET, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_NUM_GET, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT num_get<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_get<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_NUM_GET, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_num_put.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_num_put.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_num_put.h (original)
> +++ stdcxx/trunk/include/loc/_num_put.h Wed Feb 13 19:36:51 2008
> @@ -218,13 +218,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_NUM_PUT, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT num_put<char>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_put<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_NUM_PUT, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_NUM_PUT, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT num_put<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT num_put<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_NUM_PUT, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_numpunct.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_numpunct.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_numpunct.h (original)
> +++ stdcxx/trunk/include/loc/_numpunct.h Wed Feb 13 19:36:51 2008
> @@ -252,13 +252,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_NUMPUNCT, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT numpunct<char>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT numpunct<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_NUMPUNCT, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_NUMPUNCT, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT numpunct<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT numpunct<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_NUMPUNCT, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_punct.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_punct.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_punct.h (original)
> +++ stdcxx/trunk/include/loc/_punct.h Wed Feb 13 19:36:51 2008
> @@ -139,14 +139,14 @@
>  
>  #if _RWSTD_INSTANTIATE (_PUNCT, _CHAR)
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _RW::__rw_istreambuf_iterator
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _RW::__rw_istreambuf_iterator
>                            __rw_match_name (_RWSTD_ARG_LIST (char)));
>  
>  #endif   // _RWSTD_INSTANTIATE (_PUNCT, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_PUNCT, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _RW::__rw_wistreambuf_iterator
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _RW::__rw_wistreambuf_iterator
>                            __rw_match_name (_RWSTD_ARG_LIST (wchar_t)));
>  
>  #endif   // _RWSTD_INSTANTIATE (_PUNCT, _WCHAR_T)
> 
> Modified: stdcxx/trunk/include/loc/_time_get.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_time_get.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_time_get.h (original)
> +++ stdcxx/trunk/include/loc/_time_get.h Wed Feb 13 19:36:51 2008
> @@ -221,13 +221,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_TIME_GET, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT time_get<char>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT time_get<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_TIME_GET, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_TIME_GET, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT time_get<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT time_get<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_TIME_GET, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/loc/_time_put.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_time_put.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/loc/_time_put.h (original)
> +++ stdcxx/trunk/include/loc/_time_put.h Wed Feb 13 19:36:51 2008
> @@ -120,13 +120,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_TIME_PUT, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT time_put<char>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT time_put<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_TIME_PUT, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_TIME_PUT, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (struct _RWSTD_EXPORT time_put<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (struct _RWSTD_TI_EXPORT time_put<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_TIME_PUT, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/ostream
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/ostream?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/ostream (original)
> +++ stdcxx/trunk/include/ostream Wed Feb 13 19:36:51 2008
> @@ -244,14 +244,14 @@
>  // explicit instantiation followed by explicit specialization is illegal
>  // according to 14.6.4.1, p7 but MSVC allows it (linker errors otherwise)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_ostream<char, char_traits<char> >);
>  
>  #  endif   // _RWSTD_INSTANTIATE (_BASIC_OSTREAM, _CHAR)
>  
>  #  if _RWSTD_INSTANTIATE (_BASIC_OSTREAM, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_ostream<wchar_t, char_traits<wchar_t> >);
>  
>  #  endif   // _RWSTD_INSTANTIATE (_BASIC_OSTREAM, _WCHAR_T)
> @@ -554,14 +554,14 @@
>  
>  #  if _RWSTD_INSTANTIATE (_BASIC_OSTREAM, _CHAR)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_ostream<char, char_traits<char> >);
>  
>  #  endif   // _RWSTD_INSTANTIATE (_BASIC_OSTREAM, _CHAR)
>  
>  #  if _RWSTD_INSTANTIATE (_BASIC_OSTREAM, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_ostream<wchar_t, char_traits<wchar_t> >);
>  
>  #  endif   // _RWSTD_INSTANTIATE (_BASIC_OSTREAM, _WCHAR_T)
> 
> Modified: stdcxx/trunk/include/rw/_basic_ios.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_basic_ios.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/rw/_basic_ios.h (original)
> +++ stdcxx/trunk/include/rw/_basic_ios.h Wed Feb 13 19:36:51 2008
> @@ -344,14 +344,14 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_IOS, _CHAR)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_ios<char, char_traits<char> >);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_IOS, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_IOS, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_2 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
>                        basic_ios<wchar_t, char_traits<wchar_t> >);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_IOS, _WCHAR_T)
> 
> Modified: stdcxx/trunk/include/rw/_defs.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_defs.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/rw/_defs.h (original)
> +++ stdcxx/trunk/include/rw/_defs.h Wed Feb 13 19:36:51 2008
> @@ -1299,6 +1299,13 @@
>  #endif   // _RWSTD_NO_STRTOULL
>  
>  
> +#ifdef _RWSTD_LIB_SRC
> +#  define _RWSTD_TI_EXPORT    /* empty */
> +#else    // #ifndef _RWSTD_LIB_SRC
> +#  define _RWSTD_TI_EXPORT    _RWSTD_EXPORT
> +#endif   // _RWSTD_LIB_SRC
> +
> +
>  #if     defined (_RWSTD_INSTANTIATE_TEMPLATES)       \
>      && !defined (_RWSTD_NO_EXPLICIT_INSTANTIATION)   \
>      && !defined (_RWSTD_NO_INSTANTIATE)
> @@ -1311,6 +1318,9 @@
>  #  define _RWSTD_INSTANTIATE_1(arg)          template arg
>  #  define _RWSTD_INSTANTIATE_2(a1, a2)       template a1, a2
>  #  define _RWSTD_INSTANTIATE_3(a1, a2, a3)   template a1, a2, a3
> +
> +#  undef  _RWSTD_TI_EXPORT
> +#  define _RWSTD_TI_EXPORT    _RWSTD_EXPORT
>  
>  #  ifdef _RWSTD_NO_FUNCTION_EXPLICIT_INSTANTIATION
>       // replace explicit function template instantiations with
> 
> Modified: stdcxx/trunk/include/rw/_ioinsert.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_ioinsert.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/rw/_ioinsert.h (original)
> +++ stdcxx/trunk/include/rw/_ioinsert.h Wed Feb 13 19:36:51 2008
> @@ -106,23 +106,23 @@
>  
>  #  ifndef _RWSTD_NO_NATIVE_BOOL
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, bool));
>  
>  #  endif   // _RWSTD_NO_NATIVE_BOOL
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, long));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, unsigned long));
>  
>  #  ifdef _RWSTD_LONG_LONG
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, _RWSTD_LONG_LONG));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&,
>                                         unsigned _RWSTD_LONG_LONG));
>  
> @@ -133,12 +133,12 @@
>  
>  #if _RWSTD_INSTANTIATE (_INSERT_DBL, _CHAR)
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, double));
>  
>  #  ifndef _RWSTD_NO_LONG_DOUBLE
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, long double));
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
> @@ -148,10 +148,10 @@
>  
>  #if _RWSTD_INSTANTIATE (_INSERT_PTR, _CHAR)
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, const void*));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::ostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
>                            __rw_insert (_STD::ostream&, const char*,
>                                         _RWSTD_STREAMSIZE, _RWSTD_STREAMSIZE));
>  
> @@ -167,18 +167,18 @@
>  
>  #  endif   // _RWSTD_NO_NATIVE_BOOL
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&, long));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&, unsigned long));
>  
>  #  ifdef _RWSTD_LONG_LONG
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&, _RWSTD_LONG_LONG));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&,
>                                         unsigned _RWSTD_LONG_LONG));
>  
> @@ -188,12 +188,12 @@
>  
>  #if _RWSTD_INSTANTIATE (_INSERT_DBL, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&, double));
>  
>  #    ifndef _RWSTD_NO_LONG_DOUBLE
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&, long double));
>  
>  #  endif   // _RWSTD_NO_LONG_DOUBLE
> @@ -202,14 +202,14 @@
>  
>  #if _RWSTD_INSTANTIATE (_INSERT_PTR, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                        __rw_insert (_STD::wostream&, const void*));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&, const char*,
>                                         _RWSTD_STREAMSIZE, _RWSTD_STREAMSIZE));
>  
> -_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
> +_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
>                            __rw_insert (_STD::wostream&, const wchar_t*,
>                                         _RWSTD_STREAMSIZE, _RWSTD_STREAMSIZE));
>  
> 
> Modified: stdcxx/trunk/include/rw/_mutex.h
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_mutex.h?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/rw/_mutex.h (original)
> +++ stdcxx/trunk/include/rw/_mutex.h Wed Feb 13 19:36:51 2008
> @@ -409,8 +409,8 @@
>  // explicitly instantiated to work around a g++ 2.95.2 bug on COFF systems
>  // (such as IBM AIX or DEC OSF1) where it "forgets" to do so implicitly for
>  // explicitly initialized static data members
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT __rw_static_mutex<int>);
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT __rw_static_mutex<size_t>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT __rw_static_mutex<int>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT __rw_static_mutex<size_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_STATIC_MUTEX, _INT)
>  
> 
> Modified: stdcxx/trunk/include/sstream
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/sstream?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/sstream (original)
> +++ stdcxx/trunk/include/sstream Wed Feb 13 19:36:51 2008
> @@ -465,13 +465,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_STRINGBUF, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT basic_stringbuf<char>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT basic_stringbuf<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_STRINGBUF, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_STRINGBUF, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT basic_stringbuf<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT basic_stringbuf<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_STRINGBUF, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/streambuf
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/streambuf?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/streambuf (original)
> +++ stdcxx/trunk/include/streambuf Wed Feb 13 19:36:51 2008
> @@ -535,13 +535,13 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_STREAMBUF, _CHAR)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT basic_streambuf<char>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT basic_streambuf<char>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_STREAMBUF, _CHAR)
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_STREAMBUF, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_1 (class _RWSTD_EXPORT basic_streambuf<wchar_t>);
> +_RWSTD_INSTANTIATE_1 (class _RWSTD_TI_EXPORT basic_streambuf<wchar_t>);
>  
>  #endif   // _RWSTD_INSTANTIATE (_BASIC_STREAMBUF, _WCHAR_T)
>  
> 
> Modified: stdcxx/trunk/include/string
> URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/string?rev=627648&r1=627647&r2=627648&view=diff
> ==============================================================================
> --- stdcxx/trunk/include/string (original)
> +++ stdcxx/trunk/include/string Wed Feb 13 19:36:51 2008
> @@ -1634,7 +1634,7 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_STRING, _CHAR)
>  
> -_RWSTD_INSTANTIATE_3 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_3 (class _RWSTD_TI_EXPORT
>                        basic_string<char, char_traits<char>,
>                                     allocator<char> >);
>  
> @@ -1642,7 +1642,7 @@
>  
>  #if _RWSTD_INSTANTIATE (_BASIC_STRING, _WCHAR_T)
>  
> -_RWSTD_INSTANTIATE_3 (class _RWSTD_EXPORT
> +_RWSTD_INSTANTIATE_3 (class _RWSTD_TI_EXPORT
>                        basic_string<wchar_t, char_traits<wchar_t>,
>                                     allocator<wchar_t> >);
>  
> 
> 


Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
> From: Martin Sebor [mailto:sebor@roguewave.com]
> To: dev@stdcxx.apache.org
> Subject: Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/
> 
>> Do you see a way to set things up so that we can still have just
>> _RWSTD_EXPORT and use it without triggering this warning?
>  
>   We can change the _RWSTD_INSTANTIATE_N() macros to specify _RWSTD_EXPORT
> when it's needed, but then we should have two sets of these macros, say
> _RWSTD_INSTANTIATE_EXPORT_N() and _RWSTD_INSTANTIATE_N().
> _RWSTD_INSTANTIATE_EXPORT_N() will be used for exported templates, and
> _RWSTD_INSTANTIATE_N() for internal templates, i.e. __rw_pod_array.

Hmm. That doesn't seem all that much better or even different.
IMO, all these template instantiation macros are far too
complicated. It would be nice to figure out a way to simplify
the macro machinery that controls them.

Martin


Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/

Posted by Farid Zaripov <Fa...@epam.com>.
From: Martin Sebor [mailto:sebor@roguewave.com]
To: dev@stdcxx.apache.org
Subject: Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/

> Do you see a way to set things up so that we can still have just
> _RWSTD_EXPORT and use it without triggering this warning?
 
  We can change the _RWSTD_INSTANTIATE_N() macros to specify _RWSTD_EXPORT
when it's needed, but then we should have two sets of these macros, say
_RWSTD_INSTANTIATE_EXPORT_N() and _RWSTD_INSTANTIATE_N().
_RWSTD_INSTANTIATE_EXPORT_N() will be used for exported templates, and
_RWSTD_INSTANTIATE_N() for internal templates, i.e. __rw_pod_array.

Farid.
 

Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov wrote:
> From: Martin Sebor [mailto:sebor@roguewave.com]
> To: dev@stdcxx.apache.org
> Subject: Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/
> 
>> I'm not sure I understand the problem. Is it because we declare
>> some explicit template instantiations when building the library
>> as
>>
>>    extern template __declspec(dllexport) void foo<int>();
>  
>   Yes. Here the __declspec(dllexport) attribute leads to instantiating of the template class or function,
> but extern keyword tells to not instantiate, because the template will be instantiated in the another module.
> And the compiler doesn't know what to do: instantiate template in current module or not. I see that MSVC
> prefer __declspec(dllexport) and instantiates the template. So in example the classes string and wstring
> are instantiated in every .cpp file, where <string> is included. Actually this is my assumption ans I don't
> know exactly whether is true on not. But after this patch the size of the object files has reduced (the size
> of the resulting .dll in shared builds is not changed).

I see. So __declspec(dllexport) is supposed to go with defintions
while extern template (only) with declarations.

I think the problem is that we seem to use __declspec(dllexport)
on both declarations and definitions, and while that's tolerated
for declarations of ordinary functions and classes the compiler
has a small cow when we apply it to extern template kind of
declarations.

Do you see a way to set things up so that we can still have just
_RWSTD_EXPORT and use it without triggering this warning?

Martin

> 
>   From MSDN: 
> --------------
> 
> Error Message
> 
> '<identifier>' : '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
> 
> 
> The explicit template instantiation named <identifier> is modified by both the __declspec(dllexport) and extern keywords. However, these keywords are mutually exclusive. The __declspec(dllexport) keyword means instantiate the template class, while the extern keyword means do not automatically instantiate the template class.
> 
> --------------
>  
>> Why does this happen, and doesn't the problem affect ordinary
>> classes or functions as well? I.e., wouldn't either of the two
>> declarations below be a problem?
>>
>>    extern __declspec(dllexport) void foo();
>>    __declspec(dllexport) void foo();
>  
>   These declarations both are the same thing.
> 
> Farid.
>  


Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/

Posted by Farid Zaripov <Fa...@epam.com>.
From: Martin Sebor [mailto:sebor@roguewave.com]
To: dev@stdcxx.apache.org
Subject: Re: svn commit: r627648 - in /stdcxx/trunk/include: ./ loc/ rw/

> I'm not sure I understand the problem. Is it because we declare
> some explicit template instantiations when building the library
> as
> 
>    extern template __declspec(dllexport) void foo<int>();
 
  Yes. Here the __declspec(dllexport) attribute leads to instantiating of the template class or function,
but extern keyword tells to not instantiate, because the template will be instantiated in the another module.
And the compiler doesn't know what to do: instantiate template in current module or not. I see that MSVC
prefer __declspec(dllexport) and instantiates the template. So in example the classes string and wstring
are instantiated in every .cpp file, where <string> is included. Actually this is my assumption ans I don't
know exactly whether is true on not. But after this patch the size of the object files has reduced (the size
of the resulting .dll in shared builds is not changed).

  From MSDN: 
--------------

Error Message

'<identifier>' : '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation


The explicit template instantiation named <identifier> is modified by both the __declspec(dllexport) and extern keywords. However, these keywords are mutually exclusive. The __declspec(dllexport) keyword means instantiate the template class, while the extern keyword means do not automatically instantiate the template class.

--------------
 
> Why does this happen, and doesn't the problem affect ordinary
> classes or functions as well? I.e., wouldn't either of the two
> declarations below be a problem?
> 
>    extern __declspec(dllexport) void foo();
>    __declspec(dllexport) void foo();
 
  These declarations both are the same thing.

Farid.