windows_subsystem

Keep the Windows GUI subsystem linker stub alive for MoonBit native executables.

windows
gui
subsystem
native
ffi
moon add justjavac/windows_subsystem@0.1.4
Download zip
Author
Version
0.1.4
License
MIT
Last updated
2 months ago
Downloads
33
README

#justjavac/windows_subsystem

coverage

Keep the Windows GUI subsystem linker flags reachable from a MoonBit native entry package. Calls on WebAssembly and JavaScript targets are no-ops.

#Usage

Add the package and call enable() once near the start of main:

fn main {
@justjavac/windows_subsystem.enable()
// Start your GUI app here.
}

enable() does not create windows or initialize any GUI framework. On native targets, it keeps the package's stub reachable so MSVC can apply the Windows GUI subsystem linker directives to the final executable. On WebAssembly and JavaScript targets, it does nothing.

Use this package for native desktop entry binaries that should start without an extra console window on Windows.

#
enable

fn enable() -> Unit

Keeps the package's Windows GUI subsystem stub reachable during linking.

Call this once near the beginning of your native application's main function when you want the final Windows executable to use the GUI subsystem instead of opening an extra console window.

At runtime, this function does not perform initialization, create a window, or change any application state. Its only job is to reference the native C stub so MSVC can still see these linker directives:

  • /SUBSYSTEM:WINDOWS
  • /ENTRY:mainCRTStartup

Those directives are only meaningful when compiling a native executable on Windows with MSVC. On other platforms or toolchains, calling enable() remains harmless but has no observable effect beyond referencing the stub symbol.

Typical usage:
@justjavac/windows_subsystem.enable()

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io