File tree Expand file tree Collapse file tree 7 files changed +28
-11
lines changed Expand file tree Collapse file tree 7 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ endif()
1313if (MSVC )
1414 string (REPLACE "/RTC1" "" OLD_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} " )
1515 set (CMAKE_CXX_FLAGS_DEBUG "${OLD_FLAGS} " )
16- add_compile_options (/permissive- /Zc:preprocessor /JMC /std:c++latest /Za / GR- /GS- /EHsc-)
16+ add_compile_options (/permissive- /Zc:preprocessor /JMC /std:c++latest /GR- /GS- /EHsc-)
1717elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
1818 add_compile_options (-ffreestanding -nostdinc++ -fno-exceptions -fno-rtti)
1919elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ target_sources(starlib
88 process.ixx
99 PRIVATE
1010 starlib.cpp
11+ process.cpp
1112 "process.ixx" )
1213
1314target_include_directories (starlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
Original file line number Diff line number Diff line change 1+ module ;
2+ #ifdef _WIN32
3+ #include < Windows.h>
4+ #else
5+ #error Unsupported platform
6+ #endif
7+
8+ module process;
9+
10+ void starlib::process::Exit (int code)
11+ {
12+ #ifdef _WIN32
13+ ExitProcess (static_cast <UINT>(code));
14+ #else
15+ #error Unsupported platform
16+ #endif
17+ }
Original file line number Diff line number Diff line change 1+ export module process;
2+
3+ namespace starlib ::process
4+ {
5+ export [[noreturn]] void Exit (int code);
6+ }
Original file line number Diff line number Diff line change 11module starlib;
22
3- int starlib::Meow (void )
3+ extern " C " void DefaultMain (void )
44{
5- return 1234 ;
5+ starlib::process::Exit ( 1 ) ;
66}
77
88extern " C" void DefaultMain (void )
Original file line number Diff line number Diff line change 11export module starlib;
22
3- namespace starlib
4- {
5- export int Meow ();
6- }
3+ export import process;
Original file line number Diff line number Diff line change 11import starlib;
22
3- int main (void )
4- {
5- return starlib::Meow ();
6- }
You can’t perform that action at this time.
0 commit comments