autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More exit() troubles - the answer


From: Lars J. Aas
Subject: Re: More exit() troubles - the answer
Date: Fri, 19 Jan 2001 19:32:12 +0100
User-agent: Mutt/1.2.5i

Upon closer inspection I found out that I was compiling with no special
options, while the person having problems was using a linker option "/MDd".
/MD is used to link against the msvcrt library, and /MDd to link against
the debug version of that library.  *rt is probably a DLL (run-time) and
the msvcrt library is probably something like the C library.  The
alternative to linking against the run-time library is probably static
linkage, which is what I have been doing.

After a lot of tracking through windows headers I found out that when you
compile with the /MD* options, a define named _CRTIMP will be defined to
__declspec(dllimport).  When compiling without it, _CRTIMP is undefined.

The minimal example I found to work both with and without the /MD* options
is this:

#ifndef _CRTIMP
#define _CRTIMP
#endif

#ifdef __cplusplus
_CRTIMP extern "C" void exit (int) throw ();
#endif

#include <windows.h> // include to provoke the exit() mismatch error

int main() {
  exit(42);
  return 0;
}

Unless other systems use _CRTIMP for anything, I believe it should cause
no harm to add it to confdefs.h before running the exit() tests, and
simply prefix the exit prototypes with the _CRTIMP define...

  Lars J
-- 
Innovation is one percent inspiration and ninetynine percent perspiration,
and in my case; twice that...  -- Norville Barnes, `The Hudsucker Proxy'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]