diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-06-22 13:24:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-06-22 13:24:59 +0200 |
commit | 9a00b8ccfef1d13088be2d76fefcb320c269732a (patch) | |
tree | 40a7efc0bc0116cbbf035310b9341d83a0793a07 /tests/cc/modules/testscript | |
parent | e52f8358ce533742a0357fabebd96fb7f5b2609a (diff) |
Add extra support for symbol exporting in modularized projects
Since modules don't see each other's macros, we can use a single, keyword-
like macro for dll-exporting that is managed by the build system (so no
need for an "export" header). For example:
cxx.features.symexport = true
export __symexport void f ();
Diffstat (limited to 'tests/cc/modules/testscript')
-rw-r--r-- | tests/cc/modules/testscript | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/cc/modules/testscript b/tests/cc/modules/testscript index 23f8946..a65bdac 100644 --- a/tests/cc/modules/testscript +++ b/tests/cc/modules/testscript @@ -14,6 +14,8 @@ EOI +cat <<EOI >=build/root.build cxx.std = experimental +cxx.features.symexport = true + # Force modules. # cxx.features.modules = true @@ -313,3 +315,33 @@ $* test clean <<EOI exe{test}: cxx{driver} {mxx cxx}{core} bmie{foo-core}: mxx{foo-core} EOI + +: symexport +: +: Test the __symexport feature. +: +cat <<EOI >=core.mxx; + #if __cpp_modules >= 201704 + export + #endif + module foo.core; + + export __symexport int f (int); + + __symexport int g_impl (int i) {return i - 1;} + export __symexport inline int g (int i) {return g_impl (i);} + EOI +ln -s ../core.cxx core-f.cxx; +cat <<EOI >=core-g.cxx; + module foo.core; + int g_impl (int i) {return i - 1;} + EOI +cat <<EOI >=driver.cxx; + import foo.core; + int main (int argc, char*[]) {return f (argc) + g (argc);} + EOI +$* test clean <<EOI + ./: lib{foo} exe{test} # Full build. + exe{test}: cxx{driver} lib{foo} + lib{foo}: mxx{core} cxx{core-f} # core-g @@ VC + EOI |