Skip to content

Commit

Permalink
Simplify TkCygwinMainEx (int -> void return). Fix --disable-shared bu…
Browse files Browse the repository at this point in the history
…ild on Windows (broken by previous commit)
  • Loading branch information
jan.nijtmans committed Apr 30, 2024
1 parent a9bd9ec commit 682a202
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
7 changes: 2 additions & 5 deletions generic/tkMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "tkInt.h"

#if defined(_WIN32) && !defined(UNICODE) && !defined(STATIC_BUILD)
MODULE_SCOPE int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
MODULE_SCOPE void TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *);
#endif

/*
Expand Down Expand Up @@ -197,10 +197,7 @@ Tk_MainEx(
* Tk_MainEx function of libtk8.?.dll, not this one. */
if (Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY)) {
loadCygwinTk:
if (TkCygwinMainEx(argc, argv, appInitProc, interp)) {
/* Should never reach here. */
return;
}
TkCygwinMainEx(argc, argv, appInitProc, interp);
} else {
int i;

Expand Down
22 changes: 9 additions & 13 deletions generic/tkWindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -2940,7 +2940,7 @@ static HMODULE tkcygwindll = NULL;
* encoding conversions.
*/

MODULE_SCOPE int
MODULE_SCOPE void
TkCygwinMainEx(
int argc, /* Number of arguments. */
char **argv, /* Array of argument strings. */
Expand All @@ -2962,17 +2962,13 @@ TkCygwinMainEx(
memcpy(name+len-8, L"libtk8", 6 * sizeof(WCHAR));

tkcygwindll = LoadLibraryW(name);
if (!tkcygwindll) {
/* dll is not present */
return 0;
}
tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *))
(void *)GetProcAddress(tkcygwindll, "Tk_MainEx");
if (!tkmainex) {
return 0;
if (tkcygwindll) {
tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *))
(void *)GetProcAddress(tkcygwindll, "Tk_MainEx");
if (tkmainex) {
tkmainex(argc, argv, appInitProc, interp);
}
}
tkmainex(argc, argv, appInitProc, interp);
return 1;
}
#endif /* _WIN32 */

Expand Down Expand Up @@ -3003,7 +2999,7 @@ int
Tk_Init(
Tcl_Interp *interp) /* Interpreter to initialize. */
{
#if defined(_WIN32)
#if defined(_WIN32) && !defined(STATIC_BUILD)
if (tkcygwindll) {
int (*tkinit)(Tcl_Interp *);

Expand Down Expand Up @@ -3076,7 +3072,7 @@ Tk_SafeInit(
* checked at several places to differentiate the two initialisations.
*/

#if defined(_WIN32)
#if defined(_WIN32) && !defined(STATIC_BUILD)
if (tkcygwindll) {
int (*tksafeinit)(Tcl_Interp *);

Expand Down

0 comments on commit 682a202

Please sign in to comment.