I got it to work by putting the #define above the include file
in the xs code.  I tried changing the header to use a typedef,
but I got the same error.  It seems like the header file with
the #defines, that is included in the header file, which is 
included in the XS codes, is not being include-d.  Wow that
was a mouth full :-)

On 30-Jan-2003 [EMAIL PROTECTED] wrote:
> 
> On 30-Jan-2003 Nick Ing-Simmons wrote:
>> <[EMAIL PROTECTED]> writes:
>>>First a big "Hello", since I just joined the list.
>>>
>>>Now a question, I am putting a XS wrapper over a 'C' library
>>>we have.  The header files have defined types, in paticular 
>>>'#define LLONG long long', when I compile the module, I get
>>>a parse error for a header file that contains a structure that
>>>uses the "LLONG" type.  
>> 
>> That should work for XS code itself, but h2xs may be upset.
>> (Personally I never use h2xs - I always write XS by hand...)
>> 
>> How about using a typedef instead of a #define 
>> 
>>#if HAS_LONG_LONG
>> typedef long long LLONG;
>>#else
>> typedef i64 LLONG;
>>#endif
>> 
>> Have you #include-d the header in the .xs file?
>> When you say you "get a parse error" from what? xsubpp, or C compiler or perl?
>> or "h2xs"? 
>> 
> 
> 
>   It is the compiler, 
> 
> cc -c  -I/usr/local/include/tools  -fno-strict-aliasing -I/usr/local/include -O    
>-DVERSION=\"0.01\" 
> -DXS_VERSION=\"0.01\" -DPIC -fpic "-I/usr/local/lib/perl5/5.6.1/i386-freebsd/CORE"   
>Fmt.c
> In file included from Fmt.xs:5:
> /usr/local/include/tools/fmt.h:146: syntax error before `LLONG'
> *** Error code 1
> 
> ..it does compile with the C-utils, I do include the header file in the xs.
>   The LLONG is defined in another header file that is included in the fmt.h.
> 
> 
>>>I was able to get it to compile by 
>>>changing the LLONG to "long long", but I want to use the #define
>>>since it is different for our different arch.  Do I need to have
>>>a constant function for the #define?  I believe you only need the
>>>constant funcs if the #define needs to be accessible by perl user,
>>>right??
>>>
>>>                            Thanks,
>>>                                  STH
>>>
>>>----------------------------------
>>>E-Mail: [EMAIL PROTECTED]
>>>Date: 30-Jan-2003
>>>Time: 09:16:44
>>>----------------------------------
>> -- 
>> Nick Ing-Simmons
>> http://www.ni-s.u-net.com/
>> 
> 
> ----------------------------------
> E-Mail: [EMAIL PROTECTED]
> Date: 30-Jan-2003
> Time: 11:49:52
> ----------------------------------

----------------------------------
E-Mail: [EMAIL PROTECTED]
Date: 30-Jan-2003
Time: 12:10:26
----------------------------------

Reply via email to