Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!news-server.csri.toronto.edu!utgpu!cunews!spock!watson From: watson@spock (Steve Watson) Newsgroups: comp.lang.c++ Subject: Re: TC++ include file madness Message-ID: <5279@watson> Date: 12 Nov 90 14:35:54 GMT References: <58170036@hpclapd.HP.COM> Reply-To: watson@watson (Steve Watson) Organization: Mitel. Kanata (Ontario). Canada. Lines: 42 In article ahuttune@niksula.hut.fi (Ari Juhani Huttunen) writes: >It so happens I have also had trouble with iostream.h and mem.h . >In mem.h there is a code fragment: >#ifdef __cplusplus >extern "C" { >#endif >etc... (I hope I haven't violated any copyright laws..) [...............] >ps. What does extern "C" { } mean? > Ari Huttunen (ahuttune@niksula.hut.fi) extern "C" means that the functions prototyped inside the braces are to be treated as standard C, not C++ i.e. prepend underscore, do NOT perform name-mangling when writing them to the .obj. If this is documented in the TC++ manuals, then I MISSED IT! The closest it comes to this is to tell you about the 'cdecl' keyword, which actually only instructs the compiler to use C parameter-passing conventions (as opposed to Pascal). I had to find this out by trial-and-error, i.e. the linker would bomb, claiming it couldn't find the function name, editting the .obj file revealed that the name was in fact being mangled, so I looked at one of the library include files and, lo-and-behold, they all contained this 'extern "C" {}' construct! I stuck that in, and, presto! all was hunky-dory. BTW, another TC++ include file hiccup: in 'string.h', I believe there is a misplaced #endif about half-way thru the file, something like this (from memory, I'm not on my PC): #ifndef _STDC_ #define stricmp strcmpi * defining non-std aliases for #define strnicmp strncmpi * string compare funcs .... other string func protypes & macro def'ns follow e.g. 'strlwr', but the #endif isn't until the end of the file, so you get a lot of "no prototype" errors etc. if you've used those functions. Sigh. It's SO annoying to install this brand spanking new compiler and find that it barfs ALL OVER code that's been working for months... -- ====================== disclaimer =============================== "Blame me, not the Company I keep..." - Steve Watson UseNet: mitel!spock!watson@uunet.uu.net