[antlr-interest] Access Violation in InitLiterals()

Kevin J. Cummings cummings at kjchome.homeip.net
Tue Aug 7 14:44:51 PDT 2007


Kevin J. Cummings wrote:
> 	BUT, I am developing this in VC++ on a Windows XP system.  When I
> attempted to run it for the first time, it dies, in InitLiterals() on
> the following statement (the first assignment in this routine):
> 
>> 	literals["ends_with"] = 61;
> 
> By following the backtrace, I find myself in the following code in
> CharScanner.h:
> 
>> inline bool CharScannerLiteralsLess::operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const
>> {
>> 	if (scanner->getCaseSensitiveLiterals())
>> 		return ANTLR_USE_NAMESPACE(std)less<ANTLR_USE_NAMESPACE(std)string>()(x,y);
>> 	else
>> 	{
>> #ifdef NO_STRCASECMP
>> 		return (stricmp(x.c_str(),y.c_str())<0);
>> #else
>> 		return (strcasecmp(x.c_str(),y.c_str())<0);
>> #endif
>> 	}
>> }
> 
> On the call to stricmp(), the y.c_str() argument appears to be
> un-initialized (the value of the pointer is 0xcdcdcdcd).

Some more information about my project in case it helps.  ANTLR is built
as a VC++ project as a DLL.  My project is also being built as a DLL.
I'm building both DLLs with /MDd /W3 /Gm /GX /ZI /Od and linking to the
appropriate .lib files to build the executable.  In case it matters, its
VC++ 98 that's being used.

Does anyone have any experience doing this with ANTLR to know if this
will or won't work?

> What really bugs me is why does this work on Linux and not on windows.
> My first 2 grammars don't use literals, so this routine is empty in those.

> Does anyone have any advice on what I can do to make this work?

No one?

> Thanks!

-- 
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)


More information about the antlr-interest mailing list