[antlr-interest] c runtime with templates

Robert Soule robert.soule at gmail.com
Fri Feb 13 06:36:53 PST 2009


Try adding this to your grammar:

@header {
#ifndef _YourFile_H
  #include <your_includes>
  using namespace std;
#endif
}

where you replace YourFile and your_includes appropriately.
I think that you want to be able to include your stl related stuff
in your .c file, but not in your header file, and the above should
work.

-Robert

On Fri, Feb 13, 2009 at 3:52 AM, Carter Cheng <carter_cheng at yahoo.com> wrote:
>
> Hi,
>
> I have been playing around with intermingling the C runtime with some C++ STL constructs (admittedly not exception safe) and noticed I that I get what I believe are linker errors doing to interactions between the extern "C" { ... } declaration which shows up in the header file and stl includes such as #include <list> etc.
>
> Is there a way workaround this issue (ignoring for the moment the issue of STL containers throwing exceptions in C code which are uncaught).
>
> Thanks in advance,
>
> Carter
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list