clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__tkagg_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -Isrc -ID:/M/msys64/clang64/lib/python3.10/site-packages/numpy/core/include -ID:/M/msys64/clang64/include/python3.10 -c src/_tkagg.cpp -o build/temp.mingw_x86_64_clang-3.10/matplotlib.backends._tkagg/src/_tkagg.o
src/_tkagg.cpp:234:15: error: cannot initialize a variable of type 'void *' with an rvalue of type 'FARPROC' (aka 'long long (*)()')
if (void* ptr = dlsym(lib, "Tcl_SetVar")) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~
src/_tkagg.cpp:273:13: note: in instantiation of function template specialization 'load_tcl_tk<HINSTANCE__ *>' requested here
if (load_tcl_tk(modules[i])) {
^
src/_tkagg.cpp:237:15: error: cannot initialize a variable of type 'void *' with an rvalue of type 'FARPROC' (aka 'long long (*)()')
if (void* ptr = dlsym(lib, "Tk_FindPhoto")) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
src/_tkagg.cpp:240:15: error: cannot initialize a variable of type 'void *' with an rvalue of type 'FARPROC' (aka 'long long (*)()')
if (void* ptr = dlsym(lib, "Tk_PhotoPutBlock")) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
GCC:
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -O3 -march=x86-64 -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__tkagg_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -Isrc -ID:/M/msys64/ucrt64/lib/python3.10/site-packages/numpy/core/include -ID:/M/msys64/ucrt64/include/python3.10 -c src/_tkagg.cpp -o build/temp.mingw_x86_64_ucrt-3.10/matplotlib.backends._tkagg/src/_tkagg.o
src/_tkagg.cpp: In instantiation of 'bool load_tcl_tk(T) [with T = HINSTANCE__*]':
src/_tkagg.cpp:273:24: required from here
src/_tkagg.cpp:234:26: error: invalid conversion from 'FARPROC' {aka 'long long int (*)()'} to 'void*' [-fpermissive]
234 | if (void* ptr = dlsym(lib, "Tcl_SetVar")) {
| ^
| |
| FARPROC {aka long long int (*)()}
src/_tkagg.cpp:237:26: error: invalid conversion from 'FARPROC' {aka 'long long int (*)()'} to 'void*' [-fpermissive]
237 | if (void* ptr = dlsym(lib, "Tk_FindPhoto")) {
| ^
| |
| FARPROC {aka long long int (*)()}
src/_tkagg.cpp:240:26: error: invalid conversion from 'FARPROC' {aka 'long long int (*)()'} to 'void*' [-fpermissive]
240 | if (void* ptr = dlsym(lib, "Tk_PhotoPutBlock")) {
| ^
| |
| FARPROC {aka long long int (*)()}
Activity
tacaswell commented on Sep 19, 2022
I have been compiling in linux with gcc 12 without a problem.
It seems that FARPROC is a windows thing: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-callwindowprocw
@MehdiChinoune Do you understand what changed in gcc / clang to make this code fail? Do we need a windows specific version of this function?
MehdiChinoune commented on Sep 19, 2022
Nothing has changed. the previous version (3.5.3) could be built by both gcc-12 and clang-14, It is matplotlib that changed in e1fcc90
MehdiChinoune commented on Sep 19, 2022
proposed patch
tacaswell commented on Sep 20, 2022
🐑 fair enough. I forgot we had done some work on that file, sorry for answering without doing my due diligence of checking git-blame.