Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support? #4

Closed
kazimuth opened this issue Nov 22, 2017 · 14 comments
Closed

Windows support? #4

kazimuth opened this issue Nov 22, 2017 · 14 comments

Comments

@kazimuth
Copy link

I'd like to use this tool for a project, but the project requires Windows support. I'm curious how far out Windows support is, and what work needs to be done to support Windows.

@anthrotype
Copy link

I tried to compile the provided example using Windows with python 3.6 and latest rust (msvc toolchain).

The only problems I found so far are:

  1. the spec.find_dylib fails to find the compiled DLL because it always prefixes it with "lib" (whereas on windows DLL built with msvc the "lib" prefix is usually omitted) and the library extension is either ".dylib" (mac) or ".so", whereas on windows is ".dll" of course

  2. the rtld_flags in the example's setup.py contains RTLD_NODELETE, which doesn't work on windows (commenting it out, works)

  3. linking the fake extension module fails with "unresolved external symbol PyInit__native__lib"; so for Windows the hack of building the "empty.c" extension module doesn't work; it needs to actually export something.

Other than that, everything seems to work. It should be relatively simple to fix theses.
I can send some PR when I find some time, if you like.

@filmor
Copy link
Contributor

filmor commented Dec 5, 2017

I concluded exactly the same: #7

@mitsuhiko
Copy link
Member

I merged #7 now but I wonder what the best solution for the nodelete is for rust users.

@filmor
Copy link
Contributor

filmor commented Dec 13, 2017

What do you need it for? As far as I see it, the dlopened lib is kept alive for as long as the module is kept alive.

@mitsuhiko
Copy link
Member

@filmor maybe it's indeed not necessary on windows. On mac we get crashes in rust libraries on interpreter shutdown because rust registers TLS dtors which are not executed on lib unload.

@filmor
Copy link
Contributor

filmor commented Dec 13, 2017

If you can give me a test case I can check.

@anthrotype
Copy link

maybe it's indeed not necessary on windows

according to the cffi docs, the flags argument is ignored on Windows

For the optional flags argument, see man dlopen (ignored on Windows).

https://cffi.readthedocs.io/en/latest/cdef.html#ffi-dlopen-loading-libraries-in-abi-mode

Perhaps you could leave rtld_flags empty when sys.platform == "win32"?

@anthrotype
Copy link

oh, that's what #7 already does, sorry for the noise.

@theotherjimmy
Copy link
Contributor

It looks like master supports Windows. Could we have '0.1.2' with windows support please?

@theotherjimmy
Copy link
Contributor

theotherjimmy commented Feb 21, 2018

@mitsuhiko Thanks for releasing 0.1.2! We now have windows support. I'll submit a PR to update the README shortly.

EDIT: Done. See #11

@theotherjimmy
Copy link
Contributor

theotherjimmy commented Feb 21, 2018

I take it back: Windows Wheels don't contain the .dll file.

EDIT: This is true, but not a problem. There is a .pyd file that apparently contains the .dll!?

@filmor
Copy link
Contributor

filmor commented Feb 23, 2018

The pyd is the DLL.

@theotherjimmy
Copy link
Contributor

@filmor Yeah, that became clear after a bit of testing!

@mitsuhiko
Copy link
Member

Closing this as this should work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants