[antlr-interest] Re: Problem with C++ files: BaseAST.cpp

marcschellens m_schellens at hotmail.com
Fri Jan 30 02:16:51 PST 2004


--- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...> wrote:
> Hi,
> 
> On Mon, Jan 26, 2004 at 12:37:56PM -0000, marcschellens wrote:
> > Trying to port the GDL project
> > (http://sourceforge.net/projects/gnudatalanguage/) to windows, a
> > colleague found the following (ANTLR 2.7.2, C++ mode):
> > 
> > in BaseAST.cpp line 312:
> > 
> > ANTLR_API AST* const nullASTptr=0;
> > 
> > has to be changed to:
> > 
> > AST* const nullASTptr=0;
> > 
> > because:
> > "the __declspec should appear only in the declaration."
> > (MSVC)
> > 
> > Shouldn't this be changed in the original ANTLR distribution also?
> 
> What MSVC version ? He's using a DLL build ? Anycase I recall that
this was
> needed for some MSVC version once. Would have to check about when this
> entered the codebase.

It is: MSVC.NET 7.0.9466.

My colleague sorted the stuff now out, in config.hpp (line 41):

Before:
// For the DLL support contributed by Stephen Naughton
# ifdef ANTLR_EXPORTS
#	undef ANTLR_API
#	define ANTLR_API __declspec(dllexport)
# else
#	undef ANTLR_API
#	define ANTLR_API __declspec(dllimport)
# endif


Should be:
// For the DLL support contributed by Stephen Naughton
# ifdef ANTLR_EXPORTS
#    undef ANTLR_API
#    define ANTLR_API __declspec(dllexport)
# elif defined(ANTLR_IMPORTS)
#    undef ANTLR_API
#    define ANTLR_API __declspec(dllimport)
# else
#   undef ANTLR_API
#   define ANTLR_API
# endif

Without you get the following errors:
antlr\BaseAST.cpp(312) : error C2201: 'nullASTptr' : must have
external linkage in order to be exported/imported
antlr\TreeParser.cpp(39) : error C2491: 'antlr::TreeParser::ASTNULL' :
definition of dllimport static data member not allowed
antlr\Token.cpp(18): error C2491: 'antlr::Token::badToken' :
definition of dllimport static data member not allowed
antlr\Token.cpp(18): error C2720: 'antlr::Token::badToken' :
'antlr::Token::' storage-class specifier illegal on members
...


> Note: I don't have access to MSVC compilers so I'm carefull changing
stuff
> for it especially with 2.7.3 coming out soon. It might be helpfull if he
> tried the prerelease of 2.7.3 or the latest snapshot as well
(although the
> same line of code is in it, but it might have some fixes for config.hpp,
> don't have time to check at the moment).

Where can I get 2.7.3?


Greetings,

marc


 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list