----- Original Message ----- 
From: "Sisyphus" <[EMAIL PROTECTED]>
To: "inline" <inline@perl.org>
Sent: Sunday, November 12, 2006 9:21 PM
Subject: undefined reference to `sp'


> Hi,
> On Windows 2000, perl 5.8.8 (built using the MinGW port of gcc and dmake).
>
> I've been messing about (in a very basic way) with PDCurses.
>
> I have an Inline::C script (PDLCurses.pl) that contains a number of
> functions including this one:
>
> -------------------------------
> SV * wrap_isendwin() {
>     bool x = isendwin();
>     if(x) return newSViv(1);
>     return newSViv(0);
> }
> ------------------------------
>
> The script won't even compile - producing the error:
>
> PDCurses_a355.o:PDCurses_a355.c:(.text+0x117): undefined reference to `sp'
>
> If I remove (or comment out) that function everything is fine. In a C
> program (using the very same includes and library) I can do:
>
> -------------------------------
> bool b;
> .
> .
> b = isendwin();
> printf("isendwin: %d", b);
> -------------------------------
>
> so I'm quite puzzled as to what the problem is. Is it something to do with
> the "bool" type being used in an Inline::C environment ?
>

Nope ... looks like something to do with the following prototype and
definition from curses.h:

bool isendwin(void);
.
.
# define isendwin()  (SP->alive ? FALSE : TRUE)

But then the linker's undefined reference is to 'sp' ... not 'SP'. And I
didn't think Win32's case insensitivity would apply here.

In the c-MSWin32.visualc.h file in the hints folder of the perl Curses-1.15
source I found this (provided by Gurusamy Sarathy):

#undef SP /* in case this gets pulled in after perl.h */

But that doesn't help me much. I tried inserting that undef at the beginning
of the C code in my Inline::C script (before I #included curses.h) and it
only produced other errors.
Oh ... well .... without help, I will probably consign this to the "too
hard" basket .... which won't worry me unduly :-)

Cheers,
Rob

Reply via email to