[jcifs] Midlc on Windows
Michael B Allen
mba2000 at ioplex.com
Thu Apr 14 21:36:55 GMT 2005
CC-ing the jCIFS mailing list.
Tarmo Pikaro said:
> Hi !
> I'm still kinda intrested of making midlc compiler
> work. But one of the requirements which I want to
> place is for code to be able to compile in windows. No
> matter how compilation is done - visual studio,
> cygwin, ... any other thing.
> Now... I've been able to compile libmba.lib, but midlc
> can be compiled only under cygwin and it requires
> libmba.a. Any suggestions from where I should start ?
Midlc and libmba should compile on windows without cygwin. I think there's
a Makefile.msvc for VC. I haven't tried it in while but any build errors
should be limited to compiler differences, logical file handling, etc. The
code only uses standard C stuff. Pipe the output of 'nmake -f
Makefile.msvc' to a file and send it to me. I can give you a good jump on
fixes. This part is pretty easy.
But there is one issue that is not "easy". You'll see there is a file
src/preproc.c. This code takes a filename, runs the local C preprocessor
on it and creates a preprocessed file with the supplied filename. The file
preproc.c is specific to UNIX. The Windows version is src/preprocw.c
(notice the w at the end). But it's largely empty! As it is, it just
returns the filename of the input filename. That will work but you'll need
to implement this routine or you will not be able to use '#include' and
other C preprocessor directives. Use src/preproc.c as a guide and note
there's some very cruddy pseudocode for the Windows version of preproc at
the bottom of src/preproc.c. Otherwise, I think this will eventually
become a real problem for you if you're using multiple files. You could
skip this part just to move forward and then bug me about it again in a
few months (is this OSS or non-commercial work?). Eventually I will fix it
and make it build nicely on Windows.
Note: there is a file on Windows called midlc.exe which is the backend to
midl.exe. This is an unfortunate mistake. Try not to install midlc.exe in
your PATH or it might cause VC to blowup on regular midl processing.
> One question - normally when people implement parsers
> they use yacc and/or bison - you haven't used any of
> them. Is there any particular reasons for doing this ?
Yacc is overrated and bison is highly overrated. The midlc state machine
is very small compared to what I would need with yacc. It's convoluted as
hell but it's small so it's not totally unmanageable. The only benifit to
using yacc would be good validation. Midlc validation is HORRIBLE - I
could feed it Cobol and it would actually generate stubs!
Also not that Samba's PIDL is perl and will run on Windows but it's not
entirely midl compatible - you'd need to modify your idl.
More information about the jcifs