www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/07/15/20:57:22

Date: Fri, 16 Jul 93 10:08:30 CST
From: michaels AT vsl DOT com DOT AU (Michael Snoswell)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: ctype.h problem

I have djgpp 1.10 (with go32 1.10a) and all was fine until...

Last night I tried to compile indent-1.8 which uses islower() in ctype.h and
struck a most unusual problem. The compile failed, saying _ctype_ was an
undefined identifier. A quick look at ctype.h indicated some funny to and fro
with defines on names and stuff, then the islower() etc. macros use _ctype_

Somewhere in my dim past I had seen _ctype so I changed the islower() macros to
use that instead and it compiled now but wouldn't link of course, saying it
couldn't find __ctype. A light dawned and I realised there should be an 
internally generated array of type char called _ctype_ that has the special
lookup values that islower() etc uses. Running nm on a test program output
revealed no identifier of this name.

Now I haven't looked but surely in the past I've used one of the macros in
ctype.h without hassles. _ctype_ should be generated by the compiler but it's
not there at link time. I tried linking a whole bunch of libraries (libpc, libc,
libm etc) explicitly in the hope that _ctype_ was declared in one of them, but 
to no avail. In the end I declared a variable of my own, char _ctype_[512]; 
and it compiled and linked fine.

Any suggestions as to what might be going on?

By the way, indent is an excellent gnu program to reformat C code to whatever
style you desire. It's great to run over someone else's code before you read it
so you don't get distracted by their layout style. It has zillions of options
for all different kinds of things. Available from your local archie under gnu.

cheers
	Michael Snoswell

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019