blob: c9ed8e18994d5e751da8ea4b4e9e872fd237c279 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// file: libmhello/hello.mxx -*- C++ -*-
export module hello;
import std.core;
#ifndef __clang__
export
#endif
import format;
export namespace hello
{
// If you compare this interface to version 1.0, then you will notice that
// while it is API/source-compatible (the call via the old signature of
// say() is still valid) it is not ABI/binary-compatible (say() now has an
// extra argument and is inline).
//
// Notice also that inline say() now uses a type and calls a function from
// format which means libmformat is an "interface dependency" of libmhello.
//
// Note that for the default argument (and thus source-compatibility) to
// work as expected we have to re-export the format module. Failed that,
// users of our API that don't care about the volume will still have to
// explicitly import format which would be a strange requirement indeed.
__symexport void
say_formatted (const std::string& message);
#ifndef _MSC_VER
inline void
say (const std::string& name, format::volume v = format::volume::normal)
{
say_formatted (format::message ("Hello", name, v));
}
#else
// - modulewriter.cpp:4730: sorry: not yet implemented
// - also, now need to symexport inline functions for some reason
__symexport inline void
say (const std::string& name)
{
say_formatted (format::message ("Hello", name, format::volume::normal));
}
__symexport inline void
say (const std::string& name, format::volume v)
{
say_formatted (format::message ("Hello", name, v));
}
#endif
}
|