[antlr-interest] Building antlr libs on MS Visual C++ 6 SP5

Aaron Nauman aaronnauman at yahoo.com
Sun Jul 27 09:31:33 PDT 2003


I ran into a couple of issues building 2.7.2 with VC6 service pack 5.

Currently config.hpp includes the following for MSVC

// 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

This assumes that you are building a dll and causes problems when
trying to build a static library.  I suggest wrapping this with
something like

// Uncomment the following to build/use a DLL  
// Define ANTLR_EXPORTS in project settings when building DLL
// #define ANTLR_DLL 1

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

Also there are a number of template instantiations sprinkled around
the source to keep some version of MSVC happy.  

#if defined(_MSC_VER) && !defined(__ICL) // Microsoft Visual C++
extern template class ANTLR_API ASTRefCount<AST>;
#endif

These cause warnings and are not needed in the latest versions of
MSVC.  Does anyone know which versions do require these so that we can
include those only when necessary?  I had to comment these out to
build.

Aaron


 

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




More information about the antlr-interest mailing list