Extensions & importing defined constants

Hi all,

If I have a .h file (let’s call it test.h) that contains:

#define SOME_VAL 255

…and my extconf.rb file contains:


…and the source file (let’s call it test.c) contains:

#include “ruby.h”

#ifdef HAVE_TEST_H
#include <test.h>

…shouldn’t the test.c file now be able to see the SOME_VAL constant?

e.g. char buf[SOME_VAL];

In my own testing, it doesn’t seem to be able to see it. I’ll get “first
use this function” errors.

Thanks in advance for any help.



Perhaps HAVE_TEST_H isn’t getting defined? Put some junk code between
the #ifdef and #endif and see if you get an error.

The only other thing I can think of is that perhaps the test.h that is
getting included isn’t the one that has the SOME_VAL macro, or that the
SOME_VAL macro is only conditionally getting defined.



On Tue, Jun 04, 2002 at 05:49:57AM +0900, Mr. Sunblade wrote:

#ifdef HAVE_TEST_H
#include <test.h>