IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

platform_map

platform_map[T: Copyable, //, operation: Optional[String] = None, *, linux: Optional[T] = None, macos: Optional[T] = None]() -> T

Helper for defining a compile time value depending on the current compilation target, raising a compilation error if trying to access the value on an unsupported target.

Example:

from std.sys.info import platform_map

comptime EDEADLK = platform_map["EDEADLK", linux=35, macos=11]()

Parameters:

  • T (Copyable): The type of the platform-specific value.
  • operation (Optional[String]): Optional operation name for error messages.
  • linux (Optional[T]): The value to use on Linux platforms.
  • macos (Optional[T]): The value to use on macOS platforms.

Returns:

T: The platform-specific value for the current target.