This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: guile-snarf and C++


Greg Badros <gjb@cs.washington.edu> writes:

> There are a couple of problems with guile-snarf using a C++ compiler
> that I'm running into with SCWM (which still is a C program, but an
> optional extension I'm working on uses a C++ class library).

I have also had problems using guile-snarf in connection with a C++
compiler, in my case the Sparcworks 4.02 C++ compiler.

> First, the guile-snarf script assumes that `gcc' is the right way to
> invoke the compiler.  If the code is to be compiled as C++, `g++' is the 
> right way to invoke the compiler (and then, only if GNU's compiler suite 
> is installed).  

Right.  I've addressed this problem with a kludge in my local
installation, but I've thought for some time that there must be a
better way.  The guile-snarf I use looks like this:

#!/bin/sh
# Extract the initialization actions for builtin things.

${CC:-gcc} -E -DSCM_MAGIC_SNARFER $* | grep "^ *% *% *%" | sed -e "s/^ *% *% *%//"


Note the ${CC:-gcc} business.  This allows stuff like this in Makefiles to
be useful:

ext.x: ext.cc
	CC=$(C++);export CC;$(GUILE_SNARF) ext.cc $(GUILE_DEFINE) $(INCLUDES) > $@


I just thought I would follow up to say that you are not the only one
with this problem, and that maybe it deserves some thought about what
is the proper solution.

-russ


--
Experience is what allows you to recognize a mistake the second time 
you make it.