# Babylon React Native for Windows breaks on runtime with memory access vioaltion

**URL:** <https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200>\
**Category:** Bugs\
**Tags:** babylon-native, react-native\
**Created:** [September 4, 2024, 3:10am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200 "2024-09-04T03:10:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 4, 2024, 3:10am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/1 "2024-09-04T03:10:31Z")

</div>

Hello, I’m now trying to port `@babylonjs/react-native-windows` to React Native’s [New Architecture](https://github.com/microsoft/react-native-windows/wiki/Using-the-new-architecture-templates).

I successfully migrated [my `@babylonjs/react-native-macos`](https://forum.babylonjs.com/t/im-trying-to-make-babylonreactnative-to-work-on-macos/39178) to New arch with very little modification and no errors, but at this time, Windows part is making some trouble.

What I did for migrating is:

- Made a React Native new arch app named `Playground` and place it to `...\BabylonReactNative\Apps\Playground\0.74\`
- Modified `...\BabylonReactNative\Apps\Playground\0.74\scripts\version.js` to support v0.74
- Modified `...\BabylonReactNative\Package\gulpfile.js` from `Visual Studio 16 2019` to `Visual Studio 17 2022`
- Modified `winrt::Windows::UI::Xaml` to `winrt::Microsoft::UI::Xaml` at several files
- Then made a package by following [Github Readme](https://github.com/BabylonJS/BabylonReactNative/blob/master/README.md)

When I copied pacakge assets generated by `npx gulp packUWP` to my newly created test app and ran, these error occured:

```auto
     7>BabylonModule.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::Initialize(class facebook::jsi::Runtime &,class std::function<void__cdecl(class std::function<void __cdecl(void)>)>)" (?Initialize@Babylon
       Native@@YAXAEAVRuntime@jsi@facebook@@V?$function@$$A6AXV?$function@$$A6AXXZ@std@@@Z@std@@@Z) referenced in function "public: __cdecl `public: void__ cdecl winrt::BabylonReactNative::implementation::BabylonModule::CustomInitiali
       ze(struct winrt::Microsoft::ReactNative::ReactPromise<bool> const &)'::`2'::<lambda_1>::operator()(class facebook::jsi::Runtime &)const " (??R<lambda_1>@?1??CustomInitialize@BabylonModule@implementation@
       BabylonReactNative@winrt@@QEAAXAEBU?$ReactPromise@_N@ReactNative@Microsoft@5@@Z@QEBA@AEAVRuntime@jsi@facebook@@@Z)[C:\Users\jihoobyeon\Desktop\retry\node_modules\@babylonjs\reac
       t-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
     7>BabylonModule.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::ResetView(void)" (?ResetView@BabylonNative@@YAXXZ) referenced in function "public:__cdecl `public: void __cdecl winrt::BabylonReactNative::implementation::Babylon
       Module::ResetView(struct winrt::Microsoft::ReactNative::ReactPromise<bool> const &)'::`2'::<lambda_1>::operator()(void)const " (??R<lambda_1>@?1??ResetView@BabylonModule@implementation@BabylonReactNative
       @winrt@@QEAAXAEBU?$ReactPromise@_N@ReactNative@Microsoft@5@@Z@QEBA@XZ) [C:\Users\jihoobyeon\Desktop\retry\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\
       BabylonReactNative.vcxproj]
     7>EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::UpdateView(struct winrt::Microsoft::UI::Xaml::Controls::SwapChainPanel,unsigned__int64,unsigned __int64)" (?UpdateView@BabylonNative@@YAXUSwa
       pChainPanel@Controls@Xaml@UI@Microsoft@winrt@@_K1@Z) referenced in function "private: void __cdecl winrt::BabylonReactNative::implementation::EngineView::OnSizeChanged(struct winrt::Windows::Foundation::IInspectable const &,str
       uct winrt::Microsoft::UI::Xaml::SizeChangedEventArgs const &)" (?OnSizeChanged@EngineView@implementation@BabylonReactNative@winrt@@AEAAXAEBUIInspectable@Foundation@Windows@4@AEBUSizeChangedEventArgs@Xaml
       @UI@Microsoft@4@@Z)[C:\Users\jihoobyeon\Desktop\retry\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
     7>EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::UpdateMSAA(unsigned char)" (?UpdateMSAA@BabylonNative@@YAXE@Z) referenced in function "public: void__cdecl winrt::BabylonReactNative::implementation::EngineView::Upd
       ateProperties(struct winrt::Microsoft::ReactNative::IJSValueReader const &)" (?UpdateProperties@EngineView@implementation@BabylonReactNative@winrt@@QEAAXAEBUIJSValueReader@ReactNative@Microsoft@4@@Z)[C:\Users\jihoobyeon\Desktop\retry\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
     7>EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::UpdateAlphaPremultiplied(bool)" (?UpdateAlphaPremultiplied@BabylonNative@@YAX_N@Z) referenced in function "public: void__cdecl winrt::BabylonReactNative::implementat
       ion::EngineView::UpdateProperties(struct winrt::Microsoft::ReactNative::IJSValueReader const &)" (?UpdateProperties@EngineView@implementation@BabylonReactNative@winrt@@QEAAXAEBUIJSValueReader@ReactNative
       @Microsoft@4@@Z)[C:\Users\jihoobyeon\Desktop\retry\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
     7>EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::RenderView(void)" (?RenderView@BabylonNative@@YAXXZ) referenced in function "private: void__cdecl winrt::BabylonReactNative::implementation::EngineView::OnRendering(
       void)" (?OnRendering@EngineView@implementation@BabylonReactNative@winrt@@AEAAXXZ) [C:\Users\jihoobyeon\Desktop\retry\node_modules\@babylonjs\react-native-windows\windows\BabylonR
       eactNative\BabylonReactNative.vcxproj]

```

I guess `BabylonReactNative.vcxproj` is unable to find `...\node_modules\@babylonjs\react-native-windows\windows\libs\*.lib`,  
since I have tried these workarounds:

- Merging `BabylonNative.cpp` to `BabylonNative.h`  
 → This leads to `Unable to find file <Babylon/**/*.h>`
- Then writing directly `#pragma comment(lib, "*.lib")` to `pch.h`  
 → This returns to `LNK2019` error
- Moving **all** header files manually to `...\node_modules\@babylonjs\react-native\shared\` folder  
 → This leads to `<napi/napi.h>` or else external header not found

So I’m still finding linking `*.lib` files properly to the project…

ping @Cedric - who made [most of recent commits](https://github.com/BabylonJS/BabylonReactNative/commits/master/) for Babylon React Native

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 4, 2024, 7:02am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/2 "2024-09-04T07:02:59Z")

</div>

Cc [@BabylonNative](https://forum.babylonjs.com/groups/babylonnative)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 4, 2024, 3:50pm UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/3 "2024-09-04T15:50:26Z")

</div>

Hi @jihoobyeon  
I’ll take a look at this shortly.  
Usually, when I get a build issue, i try to build my branch with Github Action.  
Did you try to setup Github Action on your repo and use build scripts to build your branch?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 6, 2024, 7:21am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/4 "2024-09-06T07:21:39Z")

</div>

Assigned @Cedric on September 6, 2024, 7:21am UTC



---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 13, 2024, 12:18pm UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/5 "2024-09-13T12:18:55Z")

</div>

Sorry for late reply. I tried running `Test RN/BRN Version` at Github Action and result was this:

```auto
Run npx react-native init Playground --version 0.74.5
  npx react-native init Playground --version 0.74.5
  cp Apps/Playground/playground-shared/App.tsx ./Playground/App.tsx
  cd Playground
  npx react-native-windows-init --overwrite
  npm install @babylonjs/core@6.0
  npm install @babylonjs/loaders@6.0
  npm install @babylonjs/react-native@1.5.3-preview
  npm install @babylonjs/react-native-windows-0-74@1.5.3-preview
  npm install @react-native-community/slider
  # npm install react-native-permissions
  npx react-native autolink-windows
  msbuild.exe /r "./windows/Playground.sln"
  msbuild.exe /p:Configuration="Release" /p:Platform="x64" /m "./windows/Playground.sln"
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
npm warn exec The following package was not found and will be installed: react-native@0.75.3
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm warn deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm warn deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
⚠️ The `init` command is deprecated.
The behavior will be changed on 12/31/2024 (109 days).
- Switch to npx @react-native-community/cli init for the identical behavior.
- Refer to the documentation for information about alternative tools: https://reactnative.dev/docs/getting-started
Running: npx @react-native-community/cli init
- Downloading template
✔ Downloading template
- Copying template
✔ Copying template
- Processing template
✔ Processing template
- Installing dependencies
✖ Installing dependencies
error Installing pods failed. This doesn't affect project initialization and you can safely proceed. 
However, you will need to install pods manually when running iOS, follow additional steps in "Run instructions for iOS" section.
- Initializing Git repository
  
  Run instructions for Android:
    • Have an Android emulator running (quickest way to get started), or a device connected.
    • cd "D:\a\BabylonReactNative\BabylonReactNative\Playground" && npx react-native run-android
  
  Run instructions for Windows:
    • See https://aka.ms/ReactNativeGuideWindows for the latest up-to-date instructions.
    
  
npm warn exec The following package was not found and will be installed: react-native-windows-init@1.4.39
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
Reading project name from package.json...
Reading react-native version from node_modules...
Cannot find module 'react-native/package.json'
Require stack:
- C:\npm\cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\lib-commonjs\Cli.js
- C:\npm\cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\bin.js
Error: Cannot find module 'react-native/package.json'
Require stack:
- C:\npm\cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\lib-commonjs\Cli.js
- C:\npm\cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\bin.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Function.resolve (node:internal/modules/helpers:188:19)
    at getReactNativeVersion (C:\npm\cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\src\Cli.ts:173:33)
    at Object.reactNativeWindowsInit (C:\npm\cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\src\Cli.ts:563:27)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\npm\\cache\\_npx\\966c6a96be6f5a32\\node_modules\\react-native-windows-init\\lib-commonjs\\Cli.js',
    'C:\\npm\\cache\\_npx\\966c6a96be6f5a32\\node_modules\\react-native-windows-init\\bin.js'
  ]
}
Command failed. Re-run the command with --verbose for more information.
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm warn deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated @babel/plugin-proposal-optional-catch-binding@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
npm warn deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm warn deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm warn deprecated @babel/plugin-proposal-logical-assignment-operators@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-logical-assignment-operators instead.
npm warn deprecated @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
npm warn deprecated @babel/plugin-proposal-async-generator-functions@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
added 1142 packages, and audited 1143 packages in 35s
151 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
added 2 packages, and audited 1145 packages in 3s
151 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: Playground@0.0.1
npm error Found: @babylonjs/core@6.0.0
npm error node_modules/@babylonjs/core
npm error @babylonjs/core@"6.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @babylonjs/core@"^5.42.2" from @babylonjs/react-native@1.5.3-preview
npm error node_modules/@babylonjs/react-native
npm error @babylonjs/react-native@"1.5.3-preview" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\npm\cache\_logs\2024-09-13T12_01_11_186Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\npm\cache\_logs\2024-09-13T12_01_11_186Z-debug-0.log
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/@babylonjs%2freact-native-windows-0-74 - Not found
npm error 404
npm error 404 '@babylonjs/react-native-windows-0-74@1.5.3-preview' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: C:\npm\cache\_logs\2024-09-13T12_01_13_468Z-debug-0.log
added 1 package, and audited 1146 packages in 2s
151 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
error: unknown command 'autolink-windows'
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: ./windows/Playground.sln
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: ./windows/Playground.sln
Error: Process completed with exit code 1.

```

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 13, 2024, 12:54pm UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/6 "2024-09-13T12:54:08Z")

</div>

You can open a PR on the main repo. Or enable Github action on your repo and open a PR on your own.

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 14, 2024, 12:36pm UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/7 "2024-09-14T12:36:09Z")

</div>

Yes, I did enabled Github Action on my forked repo.  
And now I did some workarounds on Github Action .yml file and eventually I got same error with on local:

```auto
Creating library D:\a\BabylonReactNative\BabylonReactNative\Playground\windows\x64\Debug\BabylonReactNative.lib and object D:\a\BabylonReactNative\BabylonReactNative\Playground\windows\x64\Debug\BabylonReactNative.exp
BabylonModule.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::Initialize(class facebook::jsi::Runtime &,class std::function<void__cdecl(class std::function<void __cdecl(void)>)>)" (?Initialize@BabylonNative@@YAXAEAVRuntime@jsi@facebook@@V?$function@$$A6AXV?$function@$$A6AXXZ@std@@@Z@std@@@Z) referenced in function "public:__cdecl `public: void __cdecl winrt::BabylonReactNative::implementation::BabylonModule::CustomInitialize(struct winrt::Microsoft::ReactNative::ReactPromise<bool> const &)'::`2'::<lambda_1>::operator()(class facebook::jsi::Runtime &)const " (??R<lambda_1>@?1??CustomInitialize@BabylonModule@implementation@BabylonReactNative@winrt@@QEAAXAEBU?$ReactPromise@_N@ReactNative@Microsoft@5@@Z@QEBA@AEAVRuntime@jsi@facebook@@@Z) [D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
BabylonModule.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::ResetView(void)" (?ResetView@BabylonNative@@YAXXZ) referenced in function "public:__cdecl `public: void __cdecl winrt::BabylonReactNative::implementation::BabylonModule::ResetView(struct winrt::Microsoft::ReactNative::ReactPromise<bool> const &)'::`2'::<lambda_1>::operator()(void)const " (??R<lambda_1>@?1??ResetView@BabylonModule@implementation@BabylonReactNative@winrt@@QEAAXAEBU?$ReactPromise@_N@ReactNative@Microsoft@5@@Z@QEBA@XZ) [D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::UpdateView(struct winrt::Microsoft::UI::Xaml::Controls::SwapChainPanel,unsigned__int64,unsigned __int64)" (?UpdateView@BabylonNative@@YAXUSwapChainPanel@Controls@Xaml@UI@Microsoft@winrt@@_K1@Z) referenced in function "private: void__cdecl winrt::BabylonReactNative::implementation::EngineView::OnSizeChanged(struct winrt::Windows::Foundation::IInspectable const &,struct winrt::Microsoft::UI::Xaml::SizeChangedEventArgs const &)" (?OnSizeChanged@EngineView@implementation@BabylonReactNative@winrt@@AEAAXAEBUIInspectable@Foundation@Windows@4@AEBUSizeChangedEventArgs@Xaml@UI@Microsoft@4@@Z) [D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::UpdateMSAA(unsigned char)" (?UpdateMSAA@BabylonNative@@YAXE@Z) referenced in function "public: void__cdecl winrt::BabylonReactNative::implementation::EngineView::UpdateProperties(struct winrt::Microsoft::ReactNative::IJSValueReader const &)" (?UpdateProperties@EngineView@implementation@BabylonReactNative@winrt@@QEAAXAEBUIJSValueReader@ReactNative@Microsoft@4@@Z) [D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::UpdateAlphaPremultiplied(bool)" (?UpdateAlphaPremultiplied@BabylonNative@@YAX_N@Z) referenced in function "public: void__cdecl winrt::BabylonReactNative::implementation::EngineView::UpdateProperties(struct winrt::Microsoft::ReactNative::IJSValueReader const &)" (?UpdateProperties@EngineView@implementation@BabylonReactNative@winrt@@QEAAXAEBUIJSValueReader@ReactNative@Microsoft@4@@Z) [D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
EngineView.obj : error LNK2019: unresolved external symbol "void __cdecl BabylonNative::RenderView(void)" (?RenderView@BabylonNative@@YAXXZ) referenced in function "private: void__cdecl winrt::BabylonReactNative::implementation::EngineView::OnRendering(void)" (?OnRendering@EngineView@implementation@BabylonReactNative@winrt@@AEAAXXZ) [D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
D:\a\BabylonReactNative\BabylonReactNative\Playground\windows\x64\Debug\BabylonReactNative.dll : fatal error LNK1120: 6 unresolved externals [D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj]
Done Building Project "D:\a\BabylonReactNative\BabylonReactNative\Playground\node_modules\@babylonjs\react-native-windows\windows\BabylonReactNative\BabylonReactNative.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\a\BabylonReactNative\BabylonReactNative\Playground\windows\Playground\Playground.vcxproj" (GetTargetPath target(s)) -- FAILED.

```

Still fails to find precompiled libraries…

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 16, 2024, 7:15am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/8 "2024-09-16T07:15:41Z")

</div>

Can you please share a link to your repo ?

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 16, 2024, 10:35am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/9 "2024-09-16T10:35:47Z")

</div>

Oh, I forgot to link it. I apologize.

> **[GitHub - jihoobyeon/BabylonReactNative: Build React Native for macOS applications with the...](https://github.com/jihoobyeon/BabylonReactNative)**
>
> Build React Native for macOS applications with the power of Babylon Native

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 16, 2024, 11:41am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/10 "2024-09-16T11:41:50Z")

</div>

I see in the github action that you tried to use a 0-74 suffix. last supported suffix is 0-71 and it works with RN up to 0.74.2

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 16, 2024, 12:09pm UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/11 "2024-09-16T12:09:59Z")

</div>

Yup, so I already added [0.74 on Apps/Playground](https://github.com/jihoobyeon/BabylonReactNative/tree/master/Apps/Playground/0.74) and edited [Apps/Playground/scripts/version.js](https://github.com/jihoobyeon/BabylonReactNative/blob/master/Apps/Playground/scripts/version.js) and [Package/gulpfile.js](https://github.com/jihoobyeon/BabylonReactNative/blob/master/Package/gulpfile.js). to support \>=0.74( **New arch** ).  
Are there more files I have to modify it?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 17, 2024, 6:31am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/12 "2024-09-17T06:31:22Z")

</div>

Is new arch compatible with RN versions prior to 0.74? Does new arch replace libjsi so, maybe, this abi breakage can no longer exist? [Add Support for React-Native 74 and 75 · Issue #655 · BabylonJS/BabylonReactNative · GitHub](https://github.com/BabylonJS/BabylonReactNative/issues/655)

In that case, does it make sense to push new arch so we can have less different packages and we don’t have to release 2 different packages for 0.74.  
cc @ryantrem

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 17, 2024, 8:39am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/13 "2024-09-17T08:39:10Z")

</div>

I tested and found that oldest version of `react-native-windows` which [supports new arch](https://github.com/microsoft/react-native-windows/wiki/Using-the-new-architecture-templates) is 0.73. for iOS or Android, it may be supported by older versions, but I’m not sure.

And about `libjsi`, when I ported BabylonReactNative to macOS at second time(to 0.74 new arch), I remember that I had to paste `<V8JsiRuntime.h>` to compile and get binary files.  
I also found that Hermes engine still [heavily relies](https://sugandsingh5566.medium.com/exploring-the-depths-of-react-natives-new-architecture-hermes-jsi-fabric-yoga-turbo-module-d9fe7b2922fe) on JSI, so it seems not to _ **replace** _ it.

---

<div class="post-metadata">

**Author:** ![ryantrem](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ryantrem/32/34010_2.png) [@ryantrem](https://forum.babylonjs.com/u/ryantrem)\
**Post date:** [September 18, 2024, 4:30pm UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/14 "2024-09-18T16:30:32Z")

</div>

JSI is one of the building blocks of the RN “new architecture,” but I don’t know the details, just some of the high level relationships between these different parts…

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 19, 2024, 1:42pm UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/15 "2024-09-19T13:42:26Z")

</div>

I did little more investigate, and I found that even if I directly include BabylonNative header files instead of `*.lib` files, it ends up with same error.  
So I guess it seems to be not a flaw on binary libraries, rather it seems to be a flaw in BabylonReactNative code part.

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 20, 2024, 7:48am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/17 "2024-09-20T07:48:08Z")

</div>

Okay, now I managed to properly link `.lib` files!

```auto
error LNK2038: mismatch detected for '_COROUTINE_ABI'. value '1' doesn't match value '2' in BabylonModule.obj
error LNK2038: mismatch detected for 'C++/WinRT version'. value ''2.0.220110.5' doesn't match value '2.0.230706.1' in BabylonModule.obj

```

It seems to be recompile of BabylonNative is needed.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 20, 2024, 8:18am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/18 "2024-09-20T08:18:17Z")

</div>

I’ve never seen the \_COROUTINE\_ABI issue before but it might be related to the cpp winrt mismatch.  
This is a known problem. If you are building BabylonNative from the sources (Playground sample), you can make it work by changing the windows SDK version corresponding to cpp winrt version. (correct me if I’m wrong @bghgary )

```auto
-D CMAKE_SYSTEM_VERSION=10.0.19041.0 -D CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM=10.0.19041.0

```

This is not a long term valid solution and building a shared library instead might be the best.

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 20, 2024, 9:08am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/19 "2024-09-20T09:08:28Z")

</div>

Quite odd… I rebuilt all, but `BabylonNative.lib` did not generated, I think this isn’t a bug, since `BabylonNative.cpp` is in BabylonReactNative, not BabylonNative.  
So I just included `BabylonNative.cpp` instead of `BabylonNative.lib`, and now `error C2039: 'Something': is not a member of 'Babylon'` errors are _ **everywhere** _.  
I tried including `BabylonNative.cpp` to project and adding `pch.h` at top of it, but it’s same.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 20, 2024, 9:24am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/20 "2024-09-20T09:24:46Z")

</div>

any line number reported with the error? does it correspond to anything?

---

<div class="post-metadata">

**Author:** ![jihoobyeon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jihoobyeon/32/27802_2.png) [@jihoobyeon](https://forum.babylonjs.com/u/jihoobyeon)\
**Post date:** [September 20, 2024, 9:52am UTC](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200/21 "2024-09-20T09:52:24Z")

</div>

Yup, everything.  
So I included header files from BabylonNative to suppress errors, now lib files links properly, but returned to `LNK2038` C++/WinRT version mismatch even if I recompiled with Windows SDK 10.0.22621.0

Note that RN new arch uses Nuget package `Microsoft.WindowsAppSDK` instead of `Microsoft.Windows.CppWinrt`.

and `LNK2019` still appears from two library: `bimg.lib` and `MachineIndependentd.lib`.

```auto
1>bimg.lib(image.obj) : error LNK2019: "enum astcenc_error __cdecl astcenc_config_init(enum astcenc_profile,unsigned int,unsigned int,unsigned int,float,unsigned int,struct astcenc_config *)" (?astcenc_config_init@@YA?AW4astcenc_error@@W4astcenc_profile@@IIIMIPEAUastcenc_config@@@Z)"void__cdecl bimg::imageDecodeToRgba8(struct bx::AllocatorI *,void *,void const *,unsigned int,unsigned int,unsigned int,enum bimg::TextureFormat::Enum)" (?imageDecodeToRgba8@bimg@@YAXPEAUAllocatorI@bx@@PEAXPEBXIIIW4Enum@TextureFormat@1@@Z) 함수에서 참조되는 확인할 수 없는 외부 기호
1>bimg.lib(image_encode.obj) : error LNK2001: 확인할 수 없는 외부 기호 "enum astcenc_error __cdecl astcenc_config_init(enum astcenc_profile,unsigned int,unsigned int,unsigned int,float,unsigned int,struct astcenc_config *)" (?astcenc_config_init@@YA?AW4astcenc_error@@W4astcenc_profile@@IIIMIPEAUastcenc_config@@@Z)
1>bimg.lib(image.obj) : error LNK2019: "enum astcenc_error __cdecl astcenc_context_alloc(struct astcenc_config const *,unsigned int,struct astcenc_context * *)" (?astcenc_context_alloc@@YA?AW4astcenc_error@@PEBUastcenc_config@@IPEAPEAUastcenc_context@@@Z)"void__cdecl bimg::imageDecodeToRgba8(struct bx::AllocatorI *,void *,void const *,unsigned int,unsigned int,unsigned int,enum bimg::TextureFormat::Enum)" (?imageDecodeToRgba8@bimg@@YAXPEAUAllocatorI@bx@@PEAXPEBXIIIW4Enum@TextureFormat@1@@Z) 함수에서 참조되는 확인할 수 없는 외부 기호
1>bimg.lib(image_encode.obj) : error LNK2001: 확인할 수 없는 외부 기호 "enum astcenc_error __cdecl astcenc_context_alloc(struct astcenc_config const *,unsigned int,struct astcenc_context * *)" (?astcenc_context_alloc@@YA?AW4astcenc_error@@PEBUastcenc_config@@IPEAPEAUastcenc_context@@@Z)
1>bimg.lib(image.obj) : error LNK2019: "enum astcenc_error __cdecl astcenc_decompress_image(struct astcenc_context *,unsigned char const *,unsigned__int64,struct astcenc_image *,struct astcenc_swizzle const *,unsigned int)" (?astcenc_decompress_image@@YA?AW4astcenc_error@@PEAUastcenc_context@@PEBE_KPEAUastcenc_image@@PEBUastcenc_swizzle@@I@Z)"void __cdecl bimg::imageDecodeToRgba8(struct bx::AllocatorI *,void *,void const *,unsigned int,unsigned int,unsigned int,enum bimg::TextureFormat::Enum)" (?imageDecodeToRgba8@bimg@@YAXPEAUAllocatorI@bx@@PEAXPEBXIIIW4Enum@TextureFormat@1@@Z) 함수에서 참조되는 확인할 수 없는 외부 기호
1>bimg.lib(image.obj) : error LNK2019: "void __cdecl astcenc_context_free(struct astcenc_context *)" (?astcenc_context_free@@YAXPEAUastcenc_context@@@Z)"void__cdecl bimg::imageDecodeToRgba8(struct bx::AllocatorI *,void *,void const *,unsigned int,unsigned int,unsigned int,enum bimg::TextureFormat::Enum)" (?imageDecodeToRgba8@bimg@@YAXPEAUAllocatorI@bx@@PEAXPEBXIIIW4Enum@TextureFormat@1@@Z) 함수에서 참조되는 확인할 수 없는 외부 기호
1>bimg.lib(image_encode.obj) : error LNK2001: 확인할 수 없는 외부 기호 "void __cdecl astcenc_context_free(struct astcenc_context *)" (?astcenc_context_free@@YAXPEAUastcenc_context@@@Z)
1>bimg.lib(image_encode.obj) : error LNK2019: "enum astcenc_error __cdecl astcenc_compress_image(struct astcenc_context *,struct astcenc_image *,struct astcenc_swizzle const *,unsigned char *,unsigned__int64,unsigned int)" (?astcenc_compress_image@@YA?AW4astcenc_error@@PEAUastcenc_context@@PEAUastcenc_image@@PEBUastcenc_swizzle@@PEAE_KI@Z)"void __cdecl bimg::imageEncodeFromRgba8(struct bx::AllocatorI *,void *,void const *,unsigned int,unsigned int,unsigned int,enum bimg::TextureFormat::Enum,enum bimg::Quality::Enum,class bx::Error *)" (?imageEncodeFromRgba8@bimg@@YAXPEAUAllocatorI@bx@@PEAXPEBXIIIW4Enum@TextureFormat@1@W44Quality@1@PEAVError@3@@Z) 함수에서 참조되는 확인할 수 없는 외부 기호
1>MachineIndependentd.lib(ShaderLang.obj) : error LNK2019: "class TCompiler * __cdecl ConstructCompiler(enum EShLanguage,int)" (?ConstructCompiler@@YAPEAVTCompiler@@W4EShLanguage@@H@Z)ShConstructCompiler 함수에서 참조되는 확인할 수 없는 외부 기호
1>MachineIndependentd.lib(ShaderLang.obj) : error LNK2019: "class TShHandleBase * __cdecl ConstructLinker(enum EShExecutable,int)" (?ConstructLinker@@YAPEAVTShHandleBase@@W4EShExecutable@@H@Z)ShConstructLinker 함수에서 참조되는 확인할 수 없는 외부 기호
1>MachineIndependentd.lib(ShaderLang.obj) : error LNK2019: "void __cdecl DeleteLinker(class TShHandleBase *)" (?DeleteLinker@@YAXPEAVTShHandleBase@@@Z)ShDestruct 함수에서 참조되는 확인할 수 없는 외부 기호
1>MachineIndependentd.lib(ShaderLang.obj) : error LNK2019: "class TUniformMap * __cdecl ConstructUniformMap(void)" (?ConstructUniformMap@@YAPEAVTUniformMap@@XZ)ShConstructUniformMap 함수에서 참조되는 확인할 수 없는 외부 기호
1>MachineIndependentd.lib(ShaderLang.obj) : error LNK2019: "void __cdecl DeleteCompiler(class TCompiler *)" (?DeleteCompiler@@YAXPEAVTCompiler@@@Z)ShDestruct 함수에서 참조되는 확인할 수 없는 외부 기호
1>MachineIndependentd.lib(ShaderLang.obj) : error LNK2019: "void __cdecl DeleteUniformMap(class TUniformMap *)" (?DeleteUniformMap@@YAXPEAVTUniformMap@@@Z)ShDestruct 함수에서 참조되는 확인할 수 없는 외부 기호

```

(Sorry for Korean error message; these are quite long to translate)

[Next page](https://forum.babylonjs.com/t/babylon-react-native-for-windows-breaks-on-runtime-with-memory-access-vioaltion/53200.md?page=2)
