perl.h search.h interaction issue

I'm writing a bit of C code that requires both perl.h and search.h. Platform is (SUSE LINUX Enterprise Server 9 (x86_64)). I seem to be running into some kind of issue that I haven't been able to figure out and was hoping someone has seen before! If anyone has suggesions or a workaround I would be greatly appreciative :)

This code produces a compile error:
[code]#include
#include
#include

int main() {
printf("Hello World.
");
return 0;
}[/code]

output:
plxc1000> gcc -c -D__USE_GNU -D_GNU_SOURCE -fpic "-I/usr/intel/pkgs/perl/5.8.5/lib/5.8.5/x86_64-linux/CORE" test_c9.c
In file included from test_c9.c:3:
/usr/include/search.h:66: error: 'Perl_push_scope' redeclared as different kind of symbol
/usr/intel/pkgs/perl/5.8.5/lib/5.8.5/x86_64-linux/CORE/proto.h:590: error: previous declaration of 'Perl_push_scope' was here
/usr/include/search.h:66: error: 'Perl_push_scope' redeclared as different kind of symbol
/usr/intel/pkgs/perl/5.8.5/lib/5.8.5/x86_64-linux/CORE/proto.h:590: error: previous declaration of 'Perl_push_scope' was here
/usr/include/search.h:66: error: parse error before '(' token

however, if I modify the code to place the search.h include before the perl.h include:
[code]#include
#include
#include

int main() {
printf("Hello World.
");
return 0;
}[/code]

I get:
plxc1000> test_c9
Hello World.

So far so good. However, when I start actually using some of search.h I run into further issues:
[code]#include
#include
#include

int main() {
printf("Hello World.
");
ACTION a;
a = ENTER;
return 0;
}[/code]

output:
plxc1000> gcc -D__USE_GNU -D_GNU_SOURCE -fpic "-I/usr/intel/pkgs/perl/5.8.5/lib/5.8.5/x86_64-linux/CORE" test_c9.c -o test_c9
test_c9.c: In function `main':
test_c9.c:8: error: void value not ignored as it ought to be

Same code, with perl.h and EXTERN.h includes removed:
[code]#include
//#include
//#include

int main() {
printf("Hello World.
");
ACTION a;
a = ENTER;
return 0;
}[/code]

Result:
plxc1000> test_c9 Hello World.

ACTION is an enum type declared in search.h as either 'FIND' or 'ENTER' and is required for the functions I intend to use. Every time I try to set the value of an instance of it though, I get the invalid void expression error though :(

It looks like something in perl.h is causing issues with search.h or vice versa. However, I'm very new to C and I haven't been able to determine how to get around this. Here's some hopefully useful additional output. If I missed something useful, let me know and I'll add it. Thanks in advance :)

plxc1000> perl -V
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
Platform:
osname=linux, osvers=2.6.5-7.97-smp, archname=x86_64-linux
uname='linux plxb0325 2.6.5-7.97-smp #1 smp fri jul 2 14:21:59 utc 2004 x86_64 x86_64 x86_64 gnulinux '
config_args='-Uusemymalloc -Dprefix=/usr/intel/pkgs/perl/5.8.5 -Dcc=/usr/intel/pkgs/gcc/3.4.2/bin/gcc -Doptimize=none -Dloclibpth=/usr/intel/00r1/lib -Dlocincpth=/usr/intel/00r1/include -Duse64bitall -Uinstallusrbinperl -Duselargefiles -Dperladmin=tmnguye3@sedona.intel.com -Uinstallusrbinperl -des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=define uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='/usr/intel/pkgs/gcc/3.4.2/bin/gcc', ccflags ='-fno-strict-aliasing -pipe -I/usr/intel/00r1/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize=' ',
cppflags='-fno-strict-aliasing -pipe -I/usr/intel/00r1/include'
ccversion='', gccversion='3.4.2', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='/usr/intel/pkgs/gcc/3.4.2/bin/gcc', ldflags =' -L/usr/intel/00r1/lib'
libpth=/usr/intel/00r1/lib /lib /usr/lib /usr/local/lib
libs=-lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.3'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-shared -L/usr/intel/00r1/lib'


Characteristics of this binary (from libperl):
Compile-time options: USE_64_BIT_INT USE_64_BIT_ALL USE_LARGE_FILES
Built under linux
Compiled at Nov 1 2004 16:34:54
%ENV:
PERL5LIB="/usr/intel/pkgs/icc/9.0.025/lib:/nfs/pdx/disks/nehalem.pde.077/lib:/nfs/pdx/disks/nehalem.pde.077/instantclient_10_2/:/nfs/pdx/disks/nehalem.pde.077/mysql/5.0.27/lib:/nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5/x86_64-linux/Alien/SVN:/usr/ucblib:/usr/lib:/usr/intel/pkgs/freeTDS/0.61.2/lib:/nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5:/nfs/pdx/disks/nehalem.pde.077/perl/lib/5.8.5/:/nfs/pdx/disks/nehalem.pde.077/perl/Inline/lib/site_perl/5.8.5"
@INC:
/usr/intel/pkgs/icc/9.0.025/lib
/nfs/pdx/disks/nehalem.pde.077/lib/5.8.5/x86_64-linux
/nfs/pdx/disks/nehalem.pde.077/lib/5.8.5
/nfs/pdx/disks/nehalem.pde.077/lib
/nfs/pdx/disks/nehalem.pde.077/instantclient_10_2/
/nfs/pdx/disks/nehalem.pde.077/mysql/5.0.27/lib
/nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5/x86_64-linux/Alien/SVN
/usr/ucblib
/usr/lib
/usr/intel/pkgs/freeTDS/0.61.2/lib
/nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5/x86_64-linux
/nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5
/nfs/pdx/disks/nehalem.pde.077/perl/lib/5.8.5//x86_64-linux
/nfs/pdx/disks/nehalem.pde.077/perl/lib/5.8.5/
/nfs/pdx/disks/nehalem.pde.077/perl/Inline/lib/site_perl/5.8.5/x86_64-linux
/nfs/pdx/disks/nehalem.pde.077/perl/Inline/lib/site_perl/5.8.5
/usr/intel/pkgs/perl/5.8.5/lib/5.8.5/x86_64-linux
/usr/intel/pkgs/perl/5.8.5/lib/5.8.5
/usr/intel/pkgs/perl/5.8.5/lib/site_perl/5.8.5/x86_64-linux
/usr/intel/pkgs/perl/5.8.5/lib/site_perl/5.8.5
/usr/intel/pkgs/perl/5.8.5/lib/site_perl
.

plxc1000> gcc -v
Reading specs from /usr/intel/pkgs/gcc/3.4.2/lib/gcc/x86_64-suse-linux/3.4.2/specs
Configured with: ./configure --prefix=/usr/intel/pkgs/gcc/3.4.2 --host=x86_64-suse-linux --disable-libgcj --enable-languages=c,c++,f77,objc --with-ld=/usr/intel/pkgs/gcc/3.4.2/bin/gld --with-as=/usr/intel/pkgs/gcc/3.4.2/bin/gas
Thread model: posix
gcc version 3.4.2

plxc1000> cc -v
Reading specs from /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib64 --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit x86_64-suse-linux
Thread model: posix
gcc version 3.3.3 (SuSE Linux)


Comments

  • I managed to determine what the issue was by examining the preprocessor output. This is the code after the preprocessor got done with it:

    int main() {
    printf("Hello World.
    ");
    ACTION a;
    a = Perl_push_scope();
    return 0;
    }

    Apparently ENTER was being defined as Perl_push_scope() previously, so you could not assign the ACTION typedef an ENTER value as it would be preprocessed out. I resolved this by adding:
    #ifdef ENTER
    #undef ENTER
    #endif

    after my #include directives.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion