passing a file descriptor to a C library function through ctypes on windows

前端 未结 1 473
生来不讨喜
生来不讨喜 2021-02-06 12:06

I am trying to pass a file descriptor through ctypes, to a C function where writes are performed on the fd. On linux it works. On windows it doesn\'t and I don\'t understand wh

1条回答
  •  时光取名叫无心
    2021-02-06 12:39

    Windows doesn't use file descriptions like Unix does, so I'm hypothesizing that file descriptors are emulated by the C runtime. If you are using two different C runtimes (for example, if your EXE and DLL are compiled by different compilers, or with the same compiler but with different options), then each runtime will have its own "file descriptor emulation" and you can't pass a descriptor from one to the other.

    0 讨论(0)
提交回复
热议问题