Search code examples
compiler-constructioncompilationgnubisonflex-lexer

What does GNU flex library libfl provide?


I could compile a program from flex and bison generated files by

cc lex.yy.c program.tab.c -o output

and also by

cc lex.yy.c program.tab.c -lfl -o output

They both run smoothly and without any problem.

So what did libfl provide here? I tried to search the documentation but couldn't find a detailed explanation.


Solution

  • $ nm /usr/lib/x86_64-linux-gnu/libfl.a
    libmain.o:
    0000000000000000 T main
                     U yylex
    libyywrap.o:
    0000000000000000 T yywrap
    

    As you can see it provides functions main and yywrap, so you needn't define them.