Bug #231

Inconsistent use of GWENHYFAR_CB causes build failures on Windows

Added by 2 months ago. Updated 2 months ago.

Start date:
Due date:
Gwenhywfar 5.5.0, current git master
Version der Anwendung:


The following example errors are repeated for _freeData, _messageBox, _inputBox, _showBox, _hideBox, _progressStart, _progressAdvance, _progressSetTotal, _progressLog, _progressEnd, _print, _getPassword, _setPasswordStatus, _logHook, _waitForSockets, _checkCert, _keyDataFromTextOpenSsl, _execDialog, _openDialog, _closeDialog, _runDialog, _readDialogPrefs, _writeDialogPrefs, _getFilename, and _getSyncio:

C:/gcdev64/gnucash/maint/src/gwenhywfar-5.5.0/src/gui/nogui.c:192:52: warning: passing argument 2 of 'GWEN_Gui_SetMessageBoxFn' from incompatible pointer type [-Wincompatible-pointer-types]
192 | xgui->messageBoxFn=GWEN_Gui_SetMessageBoxFn(gui, _messageBox); | ^~~~~~~~~ | | | int (attribute((stdcall)) *)(GWEN_GUI *, uint32_t, const char *, const char *, const char *, const char *, const char *, uint32_t) {aka int (attribute((stdcall)) *)(GWEN_GUI *, unsigned int, const char *, const char *, const char *, const char *, const char *, unsigned int)}

C:/gcdev64/gnucash/maint/src/gwenhywfar-5.5.0/src/gui/nogui.c:233:5: error: conflicting types for '_messageBox'
233 | int _messageBox(GWEN_UNUSED GWEN_GUI *gui, | ^~~~~~~~~
C:/gcdev64/gnucash/maint/src/gwenhywfar-5.5.0/src/gui/nogui.c:49:26: note: previous declaration of '_messageBox' was here
49 | static int GWENHYWFAR_CB _messageBox(GWEN_GUI *gui, | ^~~~~~~~~

C:/gcdev64/gnucash/maint/src/gwenhywfar-5.5.0/src/gui/nogui.c:49:26: warning: '_messageBox' used but never defined
49 | static int GWENHYWFAR_CB _messageBox(GWEN_GUI *gui, | ^~~~~~~~~

0001-Consistently-use-GWENHYWFAR_CB-in-callback-decls-and.patch Magnifier - Patch to fix all GWENHYWFAR_CB build errors on Windows. (19 KB), 02/11/2021 10:05 PM


#1 Updated by 2 months ago

Additional Functions in GWEN_Gui_ShowProgress, GWEN_Gui_DialogBased_ProgressStart, GWEN_Gui_DialogBased_ProgressEnd, GWEN_Gui_DialogBased_ProgressAdvance, GWEN_Gui_DialogBased_ProgressSetTotal, GWEN_Gui_DialogBased_Progress_Log, GWEN_Gui_DialogBased_InputBox,
GWEN_Gui_DialogBased_MessageBox, GWEN_Gui_DialogBased_ShowBox, GWEN_Gui_DialogBased_HideBox, and in testthread.c _freeData and _threadRun_cb.

#2 Updated by martin 2 months ago

  • Status changed from New to Closed

Thanks, applied.

I don't usually compile the AqBanking family for Windows because it is a pain in the neck... However, I got it to cross-compile once with mingw under Linux (the depencies are hard to setup and compile in a cross-compile environment) but that didn't catch these missing GWENHYFAR_CB's...

So thanks for the patch!!

#3 Updated by 2 months ago

BTW adding GWENHYWFAR_CB on the progress bar functions (and maybe others) is a breaking signature change on the public API: I had to do to get GnuCash to compile on Windows. You didn't mention it in so perhaps it wasn't intentional.

#4 Updated by martin 2 months ago

Hmm. These GWENHYWFAR_CB attributes should always have been there, I just didn't catch that they were missing because I seldomly compile on Windoze. Maybe I will have to increase the SO-version of GWEN due to this change...

Anyway: The reason why we introduced this attribute was that otherwise using callbacks from within apps compiled with VC (I believe) led to crashes because that compiler assumed other call characteristics regarding parameter storage on the stack. But that was a long time ago. Does anyone know whether this is still necessary?

#5 Updated by 2 months ago

Well, calling conventions are still a thing, and It probably only matters when the library is compiled with different flags (or a different compiler) from the caller passing the callback. It obviously doesn't matter when both are compiled with gcc and the same CFLAGs because it's worked in GnuCash without the attribute.

Also available in: Atom PDF