Hello Richard,
With this patch and the two others I sent earlier CLN compiles with MSVC and all tests pass successfully.
Great! What version of MSVC are you using? Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
That is the latest freely available version from Visual Studio Express 2010.
1) Why does declaring a symbol extern "C" within a namespace result in another symbol than when it's declared outside the namespace? We are not declaring extern "C" but just extern. And actually it is being declared inside the namespace both times. The real problem is related to your question 3) see below.
2) Why have to qualify cl_I_constructor_from_UL() with cln:: in code clearly inside the namespace cln? You are right, it is not necessary (which doesn't make the problem less obscure, though).
3) Why can't we declare an extern function within an inline function where it's needed? Because MSVC doesn't tag the extern function with the cln:: namespace in this case. In other words, if I declare
namespace cln { extern unsigned f(); } the symbol is cln::f If I define the function namespace cln { unsigned f() {} } the symbol is also cln::f But if I declare namespace cln { inline g() { extern f(); } } the symbol is just f in the global namespace.
Assuming the answer to all three questions is "it's a bug in MSVC" Can someone with knowledge of the standard answer that question?
*) Work around the bugs in CLN using #if _MSC_VER preprocessor symbols in order to document it as a workaround. See attached file.
Thanks, Jan