From 9a00b8ccfef1d13088be2d76fefcb320c269732a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 22 Jun 2017 13:24:59 +0200 Subject: 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 (); --- tests/cc/modules/testscript | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/cc/modules/testscript') 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 <=build/root.build cxx.std = experimental +cxx.features.symexport = true + # Force modules. # cxx.features.modules = true @@ -313,3 +315,33 @@ $* test clean <=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 <=core-g.cxx; + module foo.core; + int g_impl (int i) {return i - 1;} + EOI +cat <=driver.cxx; + import foo.core; + int main (int argc, char*[]) {return f (argc) + g (argc);} + EOI +$* test clean <