Skip to content

Cygwin fixes #17415

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

Merged
merged 1 commit into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ def get_extensions(self):
include_dirs=["src"],
# psapi library needed for finding Tcl/Tk at run time.
# user32 library needed for window manipulation functions.
libraries=({"linux": ["dl"], "win32": ["psapi", "user32"]}
.get(sys.platform, [])),
libraries=({"linux": ["dl"], "win32": ["psapi", "user32"],
"cygwin": ["psapi"]}.get(sys.platform, [])),
extra_link_args={"win32": ["-mwindows"]}.get(sys.platform, []))
add_numpy_flags(ext)
add_libagg_flags(ext)
Expand Down
16 changes: 15 additions & 1 deletion src/_tkagg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
#include <Python.h>

#ifdef _WIN32
#define WIN32_DLL
#endif
#ifdef __CYGWIN__
/*
* Unfortunately cygwin's libdl inherits restrictions from the underlying
* Windows OS, at least currently. Therefore, a symbol may be loaded from a
* module by dlsym() only if it is really located in the given modile,
* dependencies are not included. So we have to use native WinAPI on Cygwin
* also.
*/
#define WIN32_DLL
#endif

#ifdef WIN32_DLL
#include <windows.h>
#define PSAPI_VERSION 1
#include <psapi.h> // Must be linked with 'psapi' library
Expand Down Expand Up @@ -122,7 +136,7 @@ int load_tk(T lib)
(Tk_PhotoPutBlock_NoComposite_t)dlsym(lib, "Tk_PhotoPutBlock_NoComposite"));
}

#ifdef _WIN32
#ifdef WIN32_DLL

/*
* On Windows, we can't load the tkinter module to get the Tk symbols, because
Expand Down