Skip to content

Commit 6d2d6de

Browse files
committed
Update version
1 parent fbc932c commit 6d2d6de

8 files changed

+44
-29
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.obj
22
*.pdb
33
*.exe
4-
*.ilk
4+
*.ilk
5+
*.ifc

Makefile.debug

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CXX = cl
22
DEFINES = -DUNICODE -DWIN32 -DWIN64 -D_DEBUG -D_CONSOLE
3-
CXXFLAGS = /experimental:module -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MDd -GR -W3 -EHsc /Fdmain.pdb $(DEFINES)
3+
CXXFLAGS = /experimental:module /std:c++latest -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MDd -GR -W3 -EHsc /Fdmain.pdb $(DEFINES)
44
INCPATH =
55
LINKER = link
66
LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"
@@ -9,14 +9,20 @@ MODULES = /module:search "$(IFCPATH)\Debug" /module:search "."
99

1010
all: main.exe
1111

12-
manager.obj:
12+
manager.ifc:
1313
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) manager.ixx
1414

15+
manager_.obj:
16+
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) manager.cpp /Fomanager_.obj
17+
1518
actor.obj:
1619
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) actor.ixx
1720

1821
main.obj:
1922
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) main.cpp
2023

21-
main.exe: actor.obj manager.obj main.obj
22-
$(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:main.exe $(LIBS) main.obj manager.obj actor.obj
24+
main.exe: actor.obj manager.ifc main.obj manager_.obj
25+
$(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:main.exe $(LIBS) main.obj manager.obj manager_.obj actor.obj
26+
27+
clean:
28+
del *.obj *.ifc *.pdb *.ilk

Makefile.release

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CXX = cl
22
DEFINES = -DUNICODE -DWIN32 -DWIN64 -D_CONSOLE -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0 -DNDEBUG
3-
CXXFLAGS = /experimental:module -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -O2 -MD -GR -W3 -EHsc /Fdmain.pdb $(DEFINES)
3+
CXXFLAGS = /experimental:module /std:c++latest -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -O2 -MD -GR -W3 -EHsc /Fdmain.pdb $(DEFINES)
44
INCPATH =
55
LINKER = link
66
LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"
@@ -9,14 +9,20 @@ MODULES = /module:search "$(IFCPATH)\Release" /module:search "."
99

1010
all: main.exe
1111

12-
manager.obj:
12+
manager.ifc:
1313
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) manager.ixx
1414

15+
manager_.obj:
16+
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) manager.cpp /Fomanager_.obj
17+
1518
actor.obj:
1619
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) actor.ixx
1720

1821
main.obj:
1922
$(CXX) -c $(CXXFLAGS) $(INCPATH) $(MODULES) main.cpp
2023

21-
main.exe: actor.obj manager.obj main.obj
22-
$(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:main.exe $(LIBS) main.obj manager.obj actor.obj
24+
main.exe: actor.obj manager.ifc main.obj manager_.obj
25+
$(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:main.exe $(LIBS) main.obj manager.obj manager_.obj actor.obj
26+
27+
clean:
28+
del *.obj *.ifc *.pdb *.ilk

README.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
Some resources:
1+
## Requirements:
2+
Visual C++ 2017 15.5
23

4+
5+
## Some resources:
36
1. [C++ Modules in VS 2015 Update 1](https://blogs.msdn.microsoft.com/vcblog/2015/12/03/c-modules-in-vs-2015-update-1/)
47
2. [Latest draft](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4647.pdf)
5-
6-
Problems in Visual C++ 2017:
7-
8-
1. Using Standard Library modules:
9-
10-
* internal compiler error when using std::string in module
11-
* link errors using std::ofstream

actor.ixx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
export module Actor;
12
import std.core;
2-
module Actor;
33

44
export template<typename T>
55
void foo(T t) {

main.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import std.core;
2-
import Manager;
2+
import manager;
33

44
int main() {
55
M m;
@@ -11,8 +11,9 @@ int main() {
1111
for(auto v: m.m_vec) {
1212
std::cout << v << std::endl;
1313
}
14-
printf("%d\n", m.b());
14+
// printf("%d\n", m.b());
15+
16+
// std::cout << m.b() << std::endl;
1517

16-
std::cout << m.b() << std::endl;
1718
return 0;
1819
}

manager.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import manager;
2+
3+
M::M(){}
4+
int M::b() {
5+
return 5;
6+
}
7+

manager.ixx

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
module Manager;
21

3-
import Actor;
2+
export module manager;
3+
44
import std.core;
55

66
export class M {
77
public:
8-
M() {
9-
10-
}
11-
int b() {
12-
return f(5);
13-
}
8+
M();
9+
int b();
1410

11+
std::string m_name;
1512
std::vector<int> m_vec;
13+
std::string m_str;
1614
};

0 commit comments

Comments
 (0)