Repository navigation
_get_osfhandle in Addon fails on Windows #6369
Description
Activity
- addedwindowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
on Apr 25, 2016 Related: #6274. We need a way to re-export symbols that aren't marked
__declspec(dllexport)but it's currently a right pain to do so.The best way to go about it is probably to make the
uv__get_osfhandle()function public.
https://github.com/libuv/libuv/blob/b12624c13693c4d29ca84b3556eadc9e9c0936a4/src/win/handle-inl.h#L165-L177I'd rather make node properly re-export symbols. We need that anyway to make linking against openssl possible on Windows. I've been nibbling at it but it's slow going.
I tried to port mmap.js to windows (https://github.com/dimichgh/mmap.js/blob/master/src/winmmap.h#L58), but due to this issue, I am now blocked.
This is hard blocker for https://github.com/resin-io/etcher. I opened an issue in libuv. I'm happy to contribute a patch to make
uv__get_osfhandle()public if they agree: libuv/libuv#1291It's a year to the day. Any progress on this?
Reacted by Wandalen@baudehlo I just sent a PR for this: libuv/libuv#1323
Reacted by Wandalen- added a commit that references this issue
on May 30, 2017 I guess this was solved by libuv/libuv#1323. Closing.
- added a commit that references this issue
on Jun 26, 2017 @bzoz yes indeed, it does work. I've updated my test app (https://github.com/davedoesdev/node-windows-fd-test, see first comment in this ticket) to use
uv_get_osfhandle.@jviotti thanks for fixing this.
Reacted by Juan Cruz Viotti and Andrei Riaskóv- added a commit that references this issue
on Jul 31, 2026
_get_osfhandlefails to map a file descriptor opened in Javascript to a handle.Please see https://github.com/davedoesdev/node-windows-fd-test for a simple repro. It's also seen in baudehlo/node-fs-ext#57 and nodejs/node-gyp#416
I think this is due to MSVCR being statically linked into Node.
_get_osfhandlecan't find a descriptor opened in Javascript because the file descriptor to handle map in the Addon is separate to the one statically linked into the Node executable.It would be nice to be able to use file descriptors passed into Addons on Windows. One idea is to expose
_get_osfhandle(or a wrapper) from the Node executable for Addons to link against and call.