[LLVMdev] Compiling TableGen with Visual Studio

Morten Ofstad morten at hue.no
Wed Oct 13 07:32:38 PDT 2004


I finally succeded in compiling TableGen with Visual Studio. In the end 
I made normal solution and project files for VS instead of using Paolo's 
SConstruct based build system because of my lacking familiarity with 
SConstruct. One of the main obstacles was getting the FileLexer and 
FileParser to build correctly.

First of all the output file for FileLexer is specified with a %option, 
which is not very convenient because this means I cannot control which 
directory this file is put in. I had to get rid of this line and specify 
the output on the command line instead. I imagine this requires some 
changes to the unix build system, which I'm not really qualified to make.

Second, there are two problems with prototypes. I have a feeling this 
has something to do with generating C or CPP files, as I am generating 
CPP files (correctly, since the .l and .y files contain cpp code and 
should really be named .lpp and .ypp) and the tools behave slightly 
different in this setting. The problems are

in FileLexer.l:

extern "C"
int yywrap()

which should be (according to VS):

extern "C" int yywrap ( void )

and in FileParser.y:

int yyerror(const char *ErrorMsg)

which should be (again according to VS):

void yyerror(char *ErrorMsg)

in the second case I have to remove the 'const' qualifier because bison 
adds the line 'extern void yyerror(char* s);' to the generated file.

I would appreciate some input on how we can fix these issues so it's 
possible to build from the same sources on both Unix and Windows in the 
future...

m.




More information about the llvm-dev mailing list