www.delorie.com/howto/djgpp/lclint-and-djgpp.html   search  
Using LCLint Win32 binary distribution with DJGPP

Author: Daniel Barker
Created: Fri Jul 23 18:54:31 1999
Updated: Sat Jul 24 01:05:22 1999

LCLint is a source-code checker for C. LCLint 2.4b is available as source code for Unix and as a binary for Win32. I describe how to use the Win32 binary with DJGPP under Windows 98. I also suggest how to work around a problem that can occur when another compiler is installed.


Note: please see the warning in the final paragraph.

Firstly, download the LCLint 2.4b Win32 binary at:

http://www.sds.lcs.mit.edu/lclint/

Install the program according to the instructions there. I have only tried the
Win32 binary under Windows 98, but the information below might also be useful
under Windows 95.

LCLint requires an environment variable named include to give the directories
containing standard headers. DJGPP does not set such a variable. Therefore, it
is necessary to set include, or LCLint will not work properly.

Some compilers DO arrange for include to have a value. For example,
installation of MetroWerks CodeWarrior Pro 4 puts something like this in
CONFIG.SYS:

set include=C:\PROGRA~1\METROW~1\CODEWA~1\WIN32-~1\HEADERS\MFC;
C:\PROGRA~1\METROW~1\CODEWA~1\WIN32-~1\HEADERS\WIN32S~1;

(which fits on a single line in CONFIG.SYS). THIS VALUE OF INCLUDE WILL
PREVENT LCLINT FROM WORKING CORRECTLY. Therefore, if you have CodeWarrior
installed, it is important to

(1) re-define include before running LCLint;

(2) use CodeWarrior's definition of include before running CodeWarrior.

A solution is to set include for LCLint in ~/.bashrc, and only run LCLint from
a BASH prompt. This leaves the above setting from CONFIG.SYS in place when I
run CodeWarrior from Windows' graphical interface. (Running CodeWarrior from
the BASH prompt might be made impossible. But I have never wanted to do that.)

This is what I have in my ~/.bashrc file to get LCLint working with the DJGPP
headers. LARCH_PATH and LCLIMPORTDIR may have different values, according to
where LCLint was installed. For example, C:\LCLINT may be a more usual
location than C:\LOCAL\LCLINT. Also, for many people, the DJGPP installation
directory will be C:\djgpp rather than C:\Local\djgpp. Replace the directories
mentioned below with those that are valid on your system.

export LARCH_PATH="C:\LOCAL\LCLINT\LIB;."
export LCLIMPORTDIR="C:\LOCAL\LCLINT\IMPORTS;."
include="C:\Local\djgpp\include"
include=$include";C:\Local\djgpp\include\libc"
include=$include";C:\Local\djgpp\include\libm"
include=$include";C:\Local\djgpp\include\debug"
incldue=$include";C:\Local\djgpp\include\inlines"
include=$include";C:\Local\djgpp\include\machine"
include=$include";C:\Local\djgpp\include\netinet"
include=$include";C:\Local\djgpp\include\sys"
export include
export INCLUDE=$include

If you use a compiler other than DJGPP from the BASH prompt, there could still
be trouble if that compiler uses INCLUDE (or include). In this case it would
be better not to set the variable in .bashrc, but to run LCLint through a
batch file or shell script which sets include for LCLint, then runs LCLint and
exits.

A remaining problem is that LCLint options may be quite long, but very long
command lines are truncated under Windows 98. A work-around is to set default
options using a .lclintrc file rather than giving all options on the command-
line (see Section 2.2 of the LCLint manual.)

I would like to thank Martin "Herbert" Dietze for considerable help with
running both LCLint and the LCLint test suite on my computer. Any mistakes in
the above are mine, but I will take NO responsibility for problems that
result. I would be glad to hear of suggestions to improve this document. E&OE.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 1999   by DJ Delorie     Updated Jul 1999