Skip to content

Feat/windows support - #1483

Draft
riteshshukla04 wants to merge 5 commits into
mrousavy:mainfrom
riteshshukla04:feat/windows-support
Draft

Feat/windows support#1483
riteshshukla04 wants to merge 5 commits into
mrousavy:mainfrom
riteshshukla04:feat/windows-support

Conversation

@riteshshukla04

Copy link
Copy Markdown
Contributor

No description provided.

riteshshukla04 and others added 5 commits August 15, 2026 19:34
The core headers compiled on iOS and Android only because libc++ and libstdc++
leak transitive includes; MSVC does not, so a large number of translation units
failed to compile on Windows with missing std symbols. Every header now includes
what it uses.

Also:
  * guard the GCC-only diagnostic pragmas so MSVC does not see them
  * treat `_DEBUG` as a debug configuration, which is what MSVC defines instead
    of `DEBUG`
  * hoist `PromiseTask` out of the function scope it was declared in

No behaviour changes - this is includes and preprocessor guards only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds the Windows platform layer and the `NitroModules` TurboModule that installs
Nitro into the JS runtime, so `HybridObject<{ windows: "c++" }>` works on
react-native-windows.

  * `NativeNitroModules` installs Nitro from a two-argument `REACT_INIT`, which
    RNW dispatches through `AddJsiInitializer` on the JS thread. That is the
    only JSI entry-point that still works under the New Architecture -
    `ExecuteJsi`, `TryGetOrCreateContextRuntime` and `ReactContext::JSRuntime`
    are deprecated there and either fail-fast in Debug or no-op in Release.
  * `UIThreadDispatcher` backs `ThreadUtils`. Windows has no process-wide handle
    to the UI thread queue the way `dispatch_get_main_queue()` and the main
    `Looper` are, so it is taken from the `ReactContext` at install time.
    `runSync` throws, because `IReactDispatcher` only exposes `Post`.
  * `NitroLogger` writes to the debugger output window; Windows has no logcat.
  * `NitroModules.vcxproj` builds a **StaticLibrary**. RNW gives every module
    image its own `JsiAbiRuntime` wrapper, so Nitro in a separate DLL would see
    a different `jsi::Runtime*` than the Hybrid Objects linked into the app,
    while `JSICache`, `PropNameIDCache` and `Dispatcher` are keyed on the
    runtime and `HybridObjectRegistry` has to be a single registry.
  * `windows/include/NitroModules/` forwards the core headers so
    `#include <NitroModules/HybridObject.hpp>` resolves the same way it does
    through the CocoaPods module on iOS. `PublicIncludeDirectories` puts them on
    the include path of every project that references this one.
  * `ReactPackageProvider` registers the module explicitly rather than through
    `AddAttributedModules`. The linker does not pull an object file out of a
    static library unless one of its symbols is referenced, so the
    `REACT_MODULE` registration would silently never run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Teaches nitrogen the `windows` platform, so `HybridObject<{ windows: "c++" }>`
generates bindings and autolinking for react-native-windows. C++ is the only
supported language there - RNW has no Swift or Kotlin equivalent - and the C++
specs are already shared with iOS and Android, so an existing C++ Hybrid Object
usually needs nothing more than adding `windows: "c++"` to its platform spec.

Two files are generated per module:

  * `<Module>+autolinking.props`, an MSBuild property sheet that adds every
    generated source to the consuming `.vcxproj` and exposes the generated
    headers through `PublicIncludeDirectories`. This is the Windows counterpart
    of `+autolinking.cmake` on Android.
  * `<Module>Autolinking.{hpp,cpp}`, an `IReactPackageProvider` that registers
    the autolinked Hybrid Objects. iOS uses `+load` and Android uses
    `JNI_OnLoad` to run registrations automatically; Windows has no such hook,
    so the registrations run from a package provider that
    `autolink-windows` wires into the app. Registration is guarded by
    `std::call_once`, because a package provider can be created more than once
    while `HybridObjectRegistry` is process-wide.

The `winrt::` namespace comes from `windows.windowsModuleName` in nitro.json and
falls back to `ios.iosModuleName`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Builds the Windows static library in Debug and Release on `windows-2022`,
against react-native-windows 0.84.0 / react-native 0.84.1 installed into a
throwaway consumer package. NitroModules.vcxproj resolves react-native-windows
by walking up to the nearest node_modules and needs jsi + ReactCommon headers to
compile against; the monorepo cannot provide them, because its react-native is
newer than any react-native-windows release.

Debug builds with `/warnaserror:C4715,C4700` so uninitialised variables and
missing returns fail the build rather than accumulating.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds a Windows guide covering installation, autolinking, the two app-side
MSBuild settings an app needs (`CppWinRTGenerateWindowsMetadata` and
`LanguageStandard`), how Nitro installs itself, and why it links statically.

Also records what is not usable yet. Beyond Hybrid Views and worklets, two types
are blocked on react-native-windows itself: `JsiAbiRuntime` crashes rather than
throwing when a `bigint` is passed from JS into native, and when an
`ArrayBuffer` created natively is returned to JS. Both work in the opposite
direction. `setExternalMemoryPressure` is an empty body there, so GC pressure
hints are ignored.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

@riteshshukla04 is attempting to deploy a commit to the Margelo Team on Vercel.

A member of the Team first needs to authorize it.

@riteshshukla04
riteshshukla04 marked this pull request as draft August 15, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant