Skip to content

An issue of forward-declaring standard library functions/objects #7

Description

@jk-jeon

I'm trying to use ut with MS-STL and your attempt of avoiding including std headers seems to cause an issue. The issue is that your declaration does not match what the std header is doing, therefore generating a bunch of warnings and linker errors. For instance, you did this:

namespace std { // iosfwd
template<class> struct char_traits;
template<class, class> class basic_ostream;
extern basic_ostream<char, char_traits<char>> clog; // only used if defined
} // namespace std

but the actual definition of std::clog in <iostream> is like this:

_EXPORT_STD extern "C++" __PURE_APPDOMAIN_GLOBAL _CRTDATA2_IMPORT ostream clog;

which expands into:

extern "C++" __declspec(dllimport) ostream clog;

I guess trying to avoid std headers is a worthy goal, but forward-declaring all the std things in a truly platform independent way would be not simple. I personally think you would need to give up on that, or at least give options to just include std headers.

By the way, clog is not defined in <iosfwd> and it requires <iostream>, according to what I understand.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions