Boost logo

Boost Users :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2007-06-26 15:42:02


Hi,
 
> Firstly hi everybody - this is my first post, and I'm just
> finding my feet with Boost:Wave.
>
> I've built and am playing with the wave driver (wave.exe) on
> an existing open source project, but I get an "error: ill
> formed preprocessor
> directive: import" error with the at a line:
>
> #import <msado15.dll> \
> rename("EOF","adoEOF") \
> no_namespace
>
> I thought this might have been an MS compatibility thing, as
> importing COM type libraries is obviously Windows-specific
> (and afaik #import does something different in GCC), but
> I've tried recompiling with BOOST_WAVE_SUPPORT_MS_EXTENSIONS
> (and have tried lots of other things) and it doesn't make any
> difference. Google hasn't shown anything up either.

Wave currently doesn't support #import as a preprocessor directive.

> Does anyone know if I can turn this error off somehow?

Wave in the Boost CVS::HEAD has a preprocessor hook 'throw_exception' which
you might want to overload. The default implementation is:

    template <typename ContextT, typename ExceptionT>
    void
    throw_exception(ContextT const& ctx, ExceptionT const& e)
    {
        boost::throw_exception(e);
    }

but you can check for a specific error here and just return from this hook
without throwing an exception. In your case 'e' is a
boost::wave::preprocess_exception, e.get_errorcode() will return
'boost::wave::preprocess_exception::ill_formed_directive', and
e.description() returns something like: 'severity: error: import'. Overall,
this is enough information to skip this particular error only.

Actually, while I was figuring out how you might solve your problem, I
implemented the needed functionality in the Wave driver applet. If the
BOOST_WAVE_SUPPORT_MS_EXTENSIONS constant is defined to something != 0 the
whole #import directive now get's copied to the output. You'll have to use
Wave from the Boost CVS::HEAD to get this functionality, though.

HTH
Regards Hartmut


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net