diff --git a/plugins/glpk/gnm-glpk.c b/plugins/glpk/gnm-glpk.c index 6df34e2..0ff9f59 100644 --- a/plugins/glpk/gnm-glpk.c +++ b/plugins/glpk/gnm-glpk.c @@ -16,6 +16,11 @@ #ifdef HAVE_SYS_WAIT_H #include #endif +#ifdef G_OS_WIN32 +#include +#define WIFEXITED(x) (x) != STILL_ACTIVE +#define WEXITSTATUS(x) (x) +#endif #define PRIVATE_KEY "::glpk::" diff --git a/plugins/lpsolve/gnm-lpsolve.c b/plugins/lpsolve/gnm-lpsolve.c index 4e2399f..f025429 100644 --- a/plugins/lpsolve/gnm-lpsolve.c +++ b/plugins/lpsolve/gnm-lpsolve.c @@ -11,6 +11,11 @@ #ifdef HAVE_SYS_WAIT_H #include #endif +#ifdef G_OS_WIN32 +#include +#define WIFEXITED(x) (x) != STILL_ACTIVE +#define WEXITSTATUS(x) (x) +#endif #define PRIVATE_KEY "::lpsolve::" diff --git a/src/Makefile.am b/src/Makefile.am index a6ddef5..6580408 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -376,7 +376,7 @@ local.def: stamp-local.def @true stamp-local.def: $(libspreadsheet_include_HEADERS) Makefile $(top_srcdir)/tools/dumpdef.pl - hdrs='$(libspreadsheet_include_HEADERS) dialogs/dialogs.h dialogs/tool-dialogs.h tools/goal-seek.h tools/analysis-tools.h'; \ + hdrs='$(libspreadsheet_include_HEADERS) dialogs/dialogs.h dialogs/tool-dialogs.h tools/goal-seek.h tools/analysis-tools.h tools/gnm-solver.h'; \ hdrs_list=''; \ for hdr in $$hdrs; do \ if test -f $(srcdir)/$$hdr; then \ diff --git a/src/tools/gnm-solver.c b/src/tools/gnm-solver.c index 4ec4e86..9940688 100644 --- a/src/tools/gnm-solver.c +++ b/src/tools/gnm-solver.c @@ -21,6 +21,11 @@ #ifdef HAVE_SYS_WAIT_H #include #endif +#ifdef G_OS_WIN32 +#include +#define WIFEXITED(x) (x) != STILL_ACTIVE +#define WEXITSTATUS(x) (x) +#endif /* ------------------------------------------------------------------------- */ @@ -1096,7 +1101,11 @@ gnm_sub_solver_clear (GnmSubSolver *subsol) } if (subsol->child_pid) { +#ifdef G_OS_WIN32 + TerminateProcess (subsol->child_pid, 127); +#else kill (subsol->child_pid, SIGKILL); +#endif g_spawn_close_pid (subsol->child_pid); subsol->child_pid = (GPid)0; } @@ -1158,9 +1167,11 @@ cb_child_exit (GPid pid, gint status, GnmSubSolver *subsol) if (WIFEXITED (status)) g_printerr ("Solver process exited with code %d\n", WEXITSTATUS (status)); +#ifndef G_OS_WIN32 else if (WIFSIGNALED (status)) g_printerr ("Solver process received signal %d\n", WTERMSIG (status)); +#endif else g_printerr ("Solver process exited with status 0x%x\n", status);