[Python-Dev] Library pragma in PC/config.h

Greg Ward gward@python.net
Thu, 3 Aug 2000 21:24:44 -0400


Hi all --

for building extensions with non-MS compilers, it sounds like a small
change to PC/config.h is needed.  Rene Liebscher suggests changing

  #ifndef USE_DL_EXPORT
  /* So nobody needs to specify the .lib in their Makefile any more */
  #ifdef _DEBUG
  #pragma comment(lib,"python20_d.lib")
  #else
  #pragma comment(lib,"python20.lib")
  #endif
  #endif /* USE_DL_EXPORT */

to

  #if !defined(USE_DL_EXPORT) && defined(_MSC_VER)
  ...

That way, the convenience pragma will still be there for MSVC users, but
it won't break building extensions with Borland C++.  (As I understand
it, Borland C++ understands the pragma, but then tries to use Python's
standard python20.lib, which of course is only for MSVC.)  Non-MSVC
users will have to explicitly supply the library, but that's OK: the
Distutils does it for them.  (Even with MSVC, because it's too much
bother *not* to specify python20.lib explicitly.)

Does this look like the right change to everyone?  I can check it in
(and on the 1.6 branch too) if it looks OK.

While I have your attention, Rene also suggests the convention of
"bcpp_python20.lib" for the Borland-format lib file, with other
compilers (library formats) supported in future similarly.  Works for me 
-- anyone have any problems with that?

        Greg
-- 
Greg Ward - programmer-at-big                           gward@python.net
http://starship.python.net/~gward/
Know thyself.  If you need help, call the CIA.