
Howard Hinnant wrote:
parsers.hpp contain:
template<class charT> basic_parsed_options<charT> parse_config_file(std::basic_istream<charT>&, const options_description&);
parsers.cpp contain: ...... template BOOST_PROGRAM_OPTIONS_DECL basic_parsed_options<char> parse_config_file(std::basic_istream<char>& is, const options_description& desc);
And the linker can't find the explicitly instantinated function. This happens only in _dll tests, so I'd suspect a bug in the compiler/linker.
Can anybody sched the light on this?
How are clients (who can view only parsers.hpp) to know that:
template<> basic_parsed_options<char> parse_config_file(std::basic_istream<char>& is, const options_description& desc);
is a function to be imported from a DLL?
I don't know ;-) Somehow, msvc and borland don't care much.
Does adding to parsers.hpp something like:
template<> __declspec(dllimport) basic_parsed_options<char> parse_config_file(std::basic_istream<char>& is, const options_description& desc);
help?
I don't think I can do this. That's explicit specialization, and and I've be required to provide the definition for it, and for wchar_t as well, no? This means I'd have to provide two identical definitions for char and wchar_t specializations? Or use an internal function that each specialization will call? This does not sound right, I only want to explicit instnantiate the function. And I think there's no way to "forward declare" an explicit instantiation. What do you think? In the meantime, I'll try adding declspec to the primary template definition. - Volodya