Hi Neil,
In july 2015 I compiled LibLouis and LibLouisUTDML as well (with an older
version of Visual Studio) and reported among others:
“Hi John,
This is not for the tools!
The changes are mostly incompatibilities with the name of vsnprintf in
logging.c (in both parts but different)
and in logging.c also:
static char initialLogFileName[256] = ""; // AA initialize to zero string
where I added ="" to initialize the logfile name
Arend
“
Arend Arends
From: Neil Soiffer
Sent: Wednesday, October 7, 2015 4:48 PM
To: liblouis-liblouisxml@xxxxxxxxxxxxx
Subject: [liblouis-liblouisxml] bug in logging.c
I'm working on updating MathPlayer on Windows (under Visual Studio 2015) to use
the latest releases of LibLouis and LibLouisUTDML. I found the following
problem in logging.c:
void EXPORT_CALL
lou_logEnd ()
{
if (logFile != NULL)
fclose (logFile);
logFile = NULL;
}
When logFile is stderr, doing an fclose on stderr causes a problem the next
time one tries to write to the logging file/stderr. I believe the test should be
if (logFile != NULL && logFile != stderr)
Although I didn't see a problem with it, the function after that (closeLogFile)
should also probably have that test, and for safety's sake, also have
logFile = NULL;
That then makes it identical to logEng, so it should just call that function.
Also, for debugging, it would be better for make_makefile.c to have these lines
for CCFLAGS that turn on debugging info for a debug build:
"CCFLAGS = $(CCFLAGS) /nologo $(INCLUDES) /W1 /c /DLBULIB /DLIBXML_STATIC",
"!ifdef DEBUG",
"CCFLAGS = $(CCFLAGS) /Zi",
"!else",
"CCFLAGS = $(CCFLAGS) /O2",
"!endif",
Similiarly, the linker flags would be better if they were
"LXCCFLAGS = $(LXCCFLAGS) /nologo /W1 /c /DLIBXML_STATIC",
"!ifdef DEBUG",
"LXCCFLAGS = $(LXCCFLAGS) /DEBUG",
"!endif",
Note that /O2 (current value) has no meaning to the Visual Studio linker.
Neil Soiffer
Senior Scientist
Design Science, Inc.
www.dessci.com