On Mon, Nov 13, 2006 at 09:03:11PM +1100, Sisyphus wrote:

> 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.

Well, I sort of know what I'm looking for, so this is cheating-ish, but:

$ grep ' SP ' *.h | grep define
XSUB.h:#define dITEMS I32 items = SP - MARK
pp.h:#define SP sp

> 
> 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 :-)


But SP in the perl sense is the stack pointer, and expects to be declared
by the macro dSP:

pp.h:#define dSP                register SV **sp = PL_stack_sp

So your problem seems to be that curses has something else called SP, and
this clashes with the perl headers and their insistence on defining a macro
to redefine SP to sp. I think you need to stop that Perl macro being in force
at the time you're using the curses macro.

Nicholas Clark

Reply via email to