Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()
if(MSVC)
string(REPLACE "/RTC1" "" OLD_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_DEBUG "${OLD_FLAGS}")
add_compile_options(/permissive- /Zc:preprocessor /JMC /std:c++latest /Za /GR- /GS- /EHsc-)
add_compile_options(/permissive- /Zc:preprocessor /JMC /std:c++latest /GR- /GS- /EHsc-)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-ffreestanding -nostdinc++ -fno-exceptions -fno-rtti)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down
1 change: 1 addition & 0 deletions starlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_sources(starlib
process.ixx
PRIVATE
starlib.cpp
process.cpp
"process.ixx")

target_include_directories(starlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
17 changes: 17 additions & 0 deletions starlib/process.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module;
#ifdef _WIN32
#include <Windows.h>
#else
#error Unsupported platform
#endif

module process;

void starlib::process::Exit(int code)
{
#ifdef _WIN32
ExitProcess(static_cast<UINT>(code));
#else
#error Unsupported platform
#endif
}
6 changes: 6 additions & 0 deletions starlib/process.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export module process;

namespace starlib::process
{
export [[noreturn]] void Exit(int code);
}
4 changes: 2 additions & 2 deletions starlib/starlib.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module starlib;

int starlib::Meow(void)
extern "C" void DefaultMain(void)
{
return 1234;
starlib::process::Exit(1);
}

extern "C" void DefaultMain(void)
Expand Down
5 changes: 1 addition & 4 deletions starlib/starlib.ixx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export module starlib;

namespace starlib
{
export int Meow();
}
export import process;
4 changes: 0 additions & 4 deletions testing/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
import starlib;

int main(void)
{
return starlib::Meow();
}