The perlxstut gives a brief description of how to access
#define's from perl (in the Example 4 "What Has Happened
Here?" section).

I can't make this work for me.  Given the code below, I've
tried 

  print "MAXNAME is ", &main::MAXNAME, "\n";
  print "MAXNAME is ", &FOO::MAXNAME, "\n";
  print "MAXNAME is ", FOO::MAXNAME, "\n";

and the result is always

  "& not defined at test.pl line 24"

Also, where can I find more documentation on perlxs?

Thanks,
  Janice

=====================================

In my foo.h file, I have:

#define MAXNAME 255

My foo.xs file has
static double
constant (char *name, int arg)
{
    errno = 0;
    switch (*name) {
    case 'A':
   break;
    case 'B': 
...
   break;
    case 'M': 
   if (strEQ(name, "MAXNAME"))
#ifdef MAXNAME
       return MAXNAME;
#else
       goto not_there;
#endif
   break;
...
  }
    errno = EINVAL;
    return 0;

not_there:
    errno = ENOENT;
    return 0;
}

MODULE = FOO    PACKAGE = FOO

...

=====================================

Reply via email to