----- Original Message ----- From: "Eric Wilhelm" <[EMAIL PROTECTED]>.
.
.
Just wanting to verify that (given that "RUBBISH" is not defined) its
an Inline::C bug that the following script will not compile:

works fine here


Oh - that's interesting. It won't work for me (using gcc) on Windows or Linux (Mandrake), so I thought it would have been a general thing.

The generated XS file looks like this:

-----------------------------------------
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#ifdef RUBBISH
void foo() {
    printf("RUBBISH is defined\n");
}
#else
void bar() {
    printf("RUBBISH not defined\n");
}
#endif
MODULE = try PACKAGE = try

PROTOTYPES: DISABLE


void
foo ()
PREINIT:
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
foo();
if (PL_markstack_ptr != temp) {
         /* truly void, because dXSARGS not invoked */
  PL_markstack_ptr = temp;
  XSRETURN_EMPTY; /* return empty stack */
       }
       /* must have used dXSARGS; list context implied */
return; /* assume stack size is correct */

void
bar ()
PREINIT:
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
bar();
if (PL_markstack_ptr != temp) {
         /* truly void, because dXSARGS not invoked */
  PL_markstack_ptr = temp;
  XSRETURN_EMPTY; /* return empty stack */
       }
       /* must have used dXSARGS; list context implied */
return; /* assume stack size is correct */
-----------------------------------------

You can see that a function called 'foo' will be visible to the compiler even if RUBBISH is not defined - and that's what leads to the error for me. Looks like some compilers/linkers must be smart/dumb enough to ignore the reference to 'foo' - but mine certainly aren't. I've just tried running the script using Microsoft's 'cl' compiler, and the same thing still happens.

Maybe some staleness in the ~/.Inline directory?

No - I removed the entire _Inline directory just to check.

Cheers,
Rob



Reply via email to