From dea547647720a9df2806383cb9c84bcd443d608a Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Fri, 16 Aug 2024 14:09:45 -0700 Subject: [PATCH] Add instructions for unloading interop. --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 812332a..cde72fb 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ cmake -S . -B build cmake --build build --config Debug ``` -The target architecture of the shared library must match the architecture of the DIRECT client you are using. For example, if you are using host.exe for 32-bit Windows, then you must configure for x86 by using CMake argument `-A Win32`. If configuring on Windows, it is recommended that you statically link against MSVC runtime using `-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded` to prevent the user from having to install the Visual C++ runtime separately. +The target architecture of the shared library must match the architecture of the DIRECT client you are using. For example, if you are using host.exe for 32-bit Windows, then you must configure for x86 by using CMake argument `-A Win32`. If configuring on Windows, it is recommended that you statically link against MSVC runtime using `-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded` to prevent the user from having to install the Visual C++ runtime separately. To build on macOS, using Xcode, supply the `-G Xcode` argument. ### Setup Instructions @@ -44,12 +44,16 @@ First copy the shared library to the directory where you intended to load it fro If you intend to use the interop with-in JavaScript use the following steps: 1. Copy `Simple.js` and `SimpleExample.js` from the `js` directory to a directory in your skin called `src/interop`. -2. Load the example code and interop using `app.loadInterop`: +2. Load the example code and interop in `/src/App.jsx` using `app.loadInterop`: ```js - require("./interop/SimpleExample"); + import "./interop/SimpleExample"; - const simplePath = "{moduleAppDirectory}{libraryPrefix}simple.{libraryExtension}"; - app.loadInterop("simple", app.expandString(simplePath)); + const simplePath = app.expandString("{moduleAppDirectory}{libraryPrefix}simple.{libraryExtension}"); + app.loadInterop("simple", simplePath); ``` +3. Call `app.unloadInterop` before `skinWindow.close()` in `src/App.jsx`: + ```js + app.unloadInterop("simple", simplePath); + ``` 3. Run `host` application with `--devtools --disablesecurity` (during production if you sign the dll you won't need this). 4. If it integrated properly, you will see the following lines in console window.