Skip Menu |

This queue is for tickets about the Coro CPAN distribution.

Report information
The Basics
Id: 11951
Status: resolved
Priority: 0/
Queue: Coro

People
Owner: MLEHMANN [...] cpan.org
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.11
Fixed in: (no value)



Subject: MSVC error signal.h(102) : error C2059: syntax error : '('
The solution as noted in http://rt.cpan.org/NoAuth/Bug.html?id=4463 is to replace #include <signal.h> with #if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX) #ifdef WIN32 #define signal win32_signal #endif #include <signal.h> #ifdef WIN32 #define signal PerlProc_signal #endif #endif
actually that isn't neccessary. The real solution is to not include signal.h under win32 #ifndef WIN32 #include <signal.h> #endif as it will be already included by XSUB.h(or EXTERN.h or perl.h) on windows
Here's a complete patch to get it to compile on win32 with MSVC. All the tests essentially freeze (unsuprising) when cede is called (cpu usage goes up).
Only in Coro-1.11-patched: 2 diff -rub Coro-1.11/Coro/libcoro/coro.c Coro-1.11-patched/Coro/libcoro/coro.c --- Coro-1.11/Coro/libcoro/coro.c 2005-03-03 09:14:28.000000000 -0800 +++ Coro-1.11-patched/Coro/libcoro/coro.c 2005-03-21 03:34:06.343750000 -0800 @@ -48,7 +48,12 @@ #if CORO_SJLJ || CORO_LOOSE || CORO_LINUX || CORO_IRIX +#ifndef WIN32 #include <signal.h> +#else +#include "perl.h" +#endif + static volatile coro_func coro_init_func; static volatile void *coro_init_arg; @@ -57,6 +62,11 @@ static void coro_init (void) { +/* avoid error C2065: 'my_perl' : undeclared identifier */ +#ifdef WIN32 + dTHX; +#endif + volatile coro_func func = coro_init_func; volatile void *arg = coro_init_arg; diff -rub Coro-1.11/Coro/libcoro/coro.h Coro-1.11-patched/Coro/libcoro/coro.h --- Coro-1.11/Coro/libcoro/coro.h 2005-03-03 09:15:34.000000000 -0800 +++ Coro-1.11-patched/Coro/libcoro/coro.h 2005-03-21 03:34:59.812500000 -0800 @@ -154,7 +154,13 @@ # define _GNU_SOURCE // for linux libc #endif +#ifdef WIN32 +/* avoid error LNK2001: unresolved external symbol _PerlProc_longjmp */ +#include <SETJMPEX.H> +#else #include <setjmp.h> +#endif + struct coro_context { jmp_buf env; diff -rub Coro-1.11/Coro/State.xs Coro-1.11-patched/Coro/State.xs --- Coro-1.11/Coro/State.xs 2005-03-03 08:57:32.000000000 -0800 +++ Coro-1.11-patched/Coro/State.xs 2005-03-21 03:29:15.250000000 -0800 @@ -29,7 +29,10 @@ #include "libcoro/coro.c" +#ifndef WIN32 #include <signal.h> +#endif + #ifdef HAVE_MMAP # include <unistd.h>
From: schmorp [...] schmorp.de
[guest - Mon Mar 21 06:47:10 2005]: Show quoted text
> Here's a complete patch to get it to compile on win32 with MSVC. > All the tests essentially freeze (unsuprising) > when cede is called (cpu usage goes up). >
The C2065 error you report is most likely a compiler bug. Nothing in libcoro.c is perl-specific (and doesn't use any perl symbols). The win32 port is gcc or cygwin-specific, for msvc libcoro.c must first be ported, or other methods have to be used (unfortunately, you haven't mentioned which coroutine creation method you used), such as ucontext or plain setjmp/longjmp.