
Paul A Bristow wrote:
I am getting an annoying warning when building boost_math.dll AND generating Microsoft VS 8.0 'managed' code /clr:pure, even at warning level 1.
(clr code is needed because we are building a Windows .net form in C# to demonstrate Math function and Statistics Distribution using John Maddock's Math Toolkit in C++. Aside - with a lot of annoying wrapping, John has made this work).
The message is:
C4793 'vararg' : causes native code generation for function 'void boost::detail::sp_enable_shared_from_this(const boost::detail::shared_count &,...)'
Adding this #pragma to the top of our boost_math.cpp file does NOT suppress it.
#pragma warning(disable: 4793) // 'vararg' : causes native code generation for function 'void boost::detail::sp_enable_shared_from_this(const boost::detail::shared_count &,...)'
Is this worrying? Is there something wrong with the pushing and popping of warnings?
If you compile with /clr:pure, you presumably don't want native functions in your assembly, so the warning is legitimate (unless the optimizer is smart enough to see that the function is empty and not include it in the assembly). Avoiding the ... isn't as trivial as it appears. You might want to try replacing inline void sp_enable_shared_from_this( shared_count const & /*pn*/, ... ) { } with struct sp_any_pointer { template<class T> sp_any_pointer( T* ) {} }; inline void sp_enable_shared_from_this( shared_count const & /*pn*/, sp_any_pointer, sp_any_pointer ) { } for the _MANAGED case and see if it helps.