[antlr-interest] Using "C" targget with memory manager - "SmartHeap"

Ivo Gaydajiev Ivo.Gaydajiev at microfocus.com
Tue Jun 23 23:20:34 PDT 2009


We are using  the "C " target of ANTLR 3.1.3 to generate our parsers. We
are also using the "Smart Heap" library. "Smart Heap" is a memory
manager which needs to redefine the "free" and "malloc". 

But when I tried to build my project using both "Smart Heap" and the
ANTLR "C" target runtime I have faced the following problem.

 

Some structures into "C" runtime ( and also into generated Lexer/Parser
sources)  contains member named "free".  As I mention the "Smart Heap"
library redefines the "free" in order to be able to take control over
the memory management. And when we have a  invocation like the following
one into ANTLR "C" target runtime

recognizer->state->ruleMemo->free(recognizer->state->ruleMemo);

they are convert to 

recognizer->state->ruleMemo->dbg_sh_free(recognizer->state->ruleMemo);

so an error is rised for missing missing member.

 

To overcome this issue we have renamed the  "free"  member to "destroy".

Do you think it is possible to make this an official change. I think
this will easy the usage of "C" target together with some memory
management libraries like "Smart Heap".

 

Thanks, 

 

Micro Focus Live On-Demand

Expert commentary, technical deep-dives, customer case studies and more
100% Online -  100% Free
Over 100 assets available at www.microfocuslive.com

Please consider the environment before printing this e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090624/15df648f/attachment.html 


More information about the antlr-interest mailing list