Description
When passing a winit::Window over a DLL all window functions are not found on the WinitApplicationDelegate. The following error is produced when trying to call window.inner_size()
invalid message send to -[WinitApplicationDelegate canBecomeMainWindow]: method not found
I did some logging of the window before and after being passed into the DLL
2025-09-01T15:41:32.005805Z CORE MAIN ID: WindowId(5302672160)
2025-09-01T15:41:32.005809Z CORE MAIN: WinitWindow {
__superclass: ManuallyDrop {
value: NSWindow {
__superclass: NSResponder {
__superclass: <WinitWindow: 0x13c105b20>,
},
},
},
__ivars: PhantomData<()>,
}
2025-09-01T15:41:32.005840Z DLL MAIN ID: WindowId(105553161520560)
2025-09-01T15:41:32.005844Z DLL MAIN: WinitWindow {
__superclass: ManuallyDrop {
value: NSWindow {
__superclass: NSResponder {
__superclass: <WinitApplicationDelegate: 0x600002b285b0>,
},
},
},
__ivars: PhantomData<()>,
}
Is calling window functions over a DLL supposed to work. I mainly want to know if this is the intended behaviour, so I don't debug for no reason.
My use case
I am writing an engine with support for hot reloading. The event loop is ran on the main thread and calls into a struct that implements a set of callbacks. When the hot reload feature is enabled these callbacks are loaded from a DLL and are reloaded when the dll changes.
Other possible solutions and why they dont work
One solution would be to not call any window functions from the DLL and instead use a queue which is polled in event loop on the non-DLL side. For my use case this has two main problems.
- It changes the architecture of the engine just to support the hot reload functionality, thus hurting the release build.
- External crates such as egui-winit use window functions. Therefore, every crate which uses window functions would need a special version to support my engine in hot reload mode.
macOS version
Winit version
0.30.12
See also #4337.
Description
When passing a winit::Window over a DLL all window functions are not found on the WinitApplicationDelegate. The following error is produced when trying to call
window.inner_size()invalid message send to -[WinitApplicationDelegate canBecomeMainWindow]: method not foundI did some logging of the window before and after being passed into the DLL
Is calling window functions over a DLL supposed to work. I mainly want to know if this is the intended behaviour, so I don't debug for no reason.
My use case
I am writing an engine with support for hot reloading. The event loop is ran on the main thread and calls into a struct that implements a set of callbacks. When the hot reload feature is enabled these callbacks are loaded from a DLL and are reloaded when the dll changes.
Other possible solutions and why they dont work
One solution would be to not call any window functions from the DLL and instead use a queue which is polled in event loop on the non-DLL side. For my use case this has two main problems.
macOS version
Winit version
0.30.12
See also #4337.