473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MSVC 6.0 Unsupported?


I've downloaded both source distro, and binary installer. Installed
python with the binary installer, when I attempted to compile
mxDateTime (mxBase) for 2.3 with MSVC 6.0 I got an error that seemed
related to forward declarations.

It seems that the #defines that makes staticforward into extern when
using the MSVC 6 compiler has been removed from object.h. So I guess
this means I should use VC++ 7.0 to compile python with?


--

Vennlig hilsen

Syver Enstad
Jul 18 '05 #1
9 2327
Syver Enstad <sy*************@online.no> writes:
It seems that the #defines that makes staticforward into extern when
using the MSVC 6 compiler has been removed from object.h. So I guess
this means I should use VC++ 7.0 to compile python with?


That assumption is definitely wrong. If VC6 fails to compile some
code, it is likely a problem in that code, not in Python.

Regards,
Martin

Jul 18 '05 #2
Gerhard Häring wrote:
Syver Enstad wrote:
I've downloaded both source distro, and binary installer. Installed
python with the binary installer, when I attempted to compile
mxDateTime (mxBase) for 2.3 with MSVC 6.0 I got an error that seemed
related to forward declarations.

It seems that the #defines that makes staticforward into extern when
using the MSVC 6 compiler has been removed from object.h. So I guess
this means I should use VC++ 7.0 to compile python with?
Huh? You couldn't be more wrong.

1) Python 2.3 binaries *are* built with MSVC6

2) staticforward was defined from exten to empty on win32 for Python 2.3


.... and that's the problem: MS VC6 doesn't work with static
forwards. Previous Python versions therefore defined a macro
called BAD_STATIC_FORWARD which triggered a work-around in
Python.

That work-around was removed in Python 2.3 for some reason
I don't understand (and I just stumbled over it when I tried
to compile egenix-mx-base against Python 2.3 on Windows --
we do regular builds against the Python 2.3 on Linux and gcc
does not botch the static forwards, so we didn't see the
problem before the Python 2.3 release).
3) The quick hack I used is to insert something like:

#ifdef _MSC_VER
#define staticforward extern
#endif

in the relevant source files *after* they include Python.h.
The best thing to do is to replace this code in Python's object.h
file (Python23\Include\object.h; note the comment !):

/*
Define staticforward and statichere for source compatibility with old
C extensions.

The staticforward define was needed to support certain broken C
compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the
static keyword when it was used with a forward declaration of a static
initialized structure. Standard C allows the forward declaration with
static, and we've decided to stop catering to broken C compilers.
(In fact, we expect that the compilers are all fixed eight years later.)
*/

#define staticforward static
#define statichere static

with this snippet (the previously used one):

/*
A common programming style in Python requires the forward declaration
of static, initialized structures, e.g. for a type object that is used
by the functions whose address must be used in the initializer.
Some compilers (notably SCO ODT 3.0, I seem to remember early AIX as
well) botch this if you use the static keyword for both declarations
(they allocate two objects, and use the first, uninitialized one until
the second declaration is encountered). Therefore, the forward
declaration should use the 'forwardstatic' keyword. This expands to
static on most systems, but to extern on a few. The actual storage
and name will still be static because the second declaration is
static, so no linker visible symbols will be generated. (Standard C
compilers take offense to the extern forward declaration of a static
object, so I can't just put extern in all cases. :-( )
*/

#ifdef BAD_STATIC_FORWARD
#define staticforward extern
#define statichere static
#else /* !BAD_STATIC_FORWARD */
#define staticforward static
#define statichere static
#endif /* !BAD_STATIC_FORWARD */
Anyway you can't compile the eGenix extensions with Python 2.3. I hoped
this gets fixed soon. The compile fails somewhere in the mxTextTools
stuff. All I needed was mxDateTime and I got that to compile.

If you need Windoze binaries, I've uploaded some for the pyPgSQL project
at http://sourceforge.net/project/showf...group_id=16528

pypgsql-experimental

Python 2.3b2 2003-07-17 11:22
egenix-mx-base-2.0.4.win32-py2.3.exe 471273 6 i386
.exe (32-bit Windows)


FYI, we'll release fixed versions later this week.

--
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source (#1, Aug 06 2003)
Python/Zope Products & Consulting ... http://www.egenix.com/
mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

__________________________________________________ ______________________
Jul 18 '05 #3
"M.-A. Lemburg" <ma*@lemburg.com> writes:
The best thing to do is to replace this code in Python's object.h
file (Python23\Include\object.h; note the comment !):


That's exactly what I did and it worked fine.
Jul 18 '05 #4
Syver Enstad wrote:
"M.-A. Lemburg" <ma*@lemburg.com> writes:
The best thing to do is to replace this code in Python's object.h
file (Python23\Include\object.h; note the comment !):


That's exactly what I did and it worked fine.


Requiring users of my software to patch their Python instalation is not
an option for me.

-- Gerhard

Jul 18 '05 #5
Gerhard Häring <gh@ghaering.de> writes:
Syver Enstad wrote:
"M.-A. Lemburg" <ma*@lemburg.com> writes:
The best thing to do is to replace this code in Python's object.h
file (Python23\Include\object.h; note the comment !):

That's exactly what I did and it worked fine.


Requiring users of my software to patch their Python instalation is
not an option for me.


But Gerhard, what can I do? Every python extension that I will try to
compile will fail if it depends on a working staticforward. The most
rational thing to me is to patch object.h instead of patching every
..cpp/.c file that needs this define.

--

Vennlig hilsen

Syver Enstad
Jul 18 '05 #6
Syver Enstad wrote:
Gerhard Häring <gh@ghaering.de> writes:
Syver Enstad wrote:
"M.-A. Lemburg" <ma*@lemburg.com> writes:
The best thing to do is to replace this code in Python's object.h
file (Python23\Include\object.h; note the comment !):

That's exactly what I did and it worked fine.


Requiring users of my software to patch their Python instalation is
not an option for me.


But Gerhard, what can I do? Every python extension that I will try to
compile will fail if it depends on a working staticforward. The most
rational thing to me is to patch object.h instead of patching every
.cpp/.c file that needs this define.


Yeah sure. That's the best option for *you* if you want existing
(noncompatible) Python extensions :)

I was playing the side of an author of Open Source Software that should
be buildable with Python 2.3 and MSVC6. That's where my different view
on this issue comes from :-)

-- Gerhard

Jul 18 '05 #7
"Syver Enstad" <sy*************@online.no> wrote in message news:u4***********@online.no...
Gerhard Häring <gh@ghaering.de> writes:
Syver Enstad wrote:
"M.-A. Lemburg" <ma*@lemburg.com> writes:

>The best thing to do is to replace this code in Python's object.h
>file (Python23\Include\object.h; note the comment !):
That's exactly what I did and it worked fine.


Requiring users of my software to patch their Python instalation is
not an option for me.


But Gerhard, what can I do? Every python extension that I will try to
compile will fail if it depends on a working staticforward. The most
rational thing to me is to patch object.h instead of patching every
.cpp/.c file that needs this define.

--

Vennlig hilsen

Syver Enstad

syver,

i agree, patching object.h is the only rational thing to do... everyone in my company will do the same. i'm using pyrex and
everytime i regenerate the c file, i need to repatch the intermediate c file. i got tired of this so i just patched object.h and
now i this issue is gone. i'm not sure if there is a better (more convenient) way. it was this way before 2.3 and everything
worked just fine, so there shouldn't be any harm doing this in 2.3. i feel it was taken out for political reasons when it should
have been left in for technical reasons. after all, the windows verson of python at www.python.org is compiled in msvc. so
obviously the python community accepts msvc as an exceptable compiler on windows. care should have been taken to be more
accomodating.

bryan
Jul 18 '05 #8
Syver Enstad wrote:
But Gerhard, what can I do? Every python extension that I will try to
compile will fail if it depends on a working staticforward. The most
rational thing to me is to patch object.h instead of patching every
.cpp/.c file that needs this define.


Can't you just add a single compiler option (for cl.exe) to your project?

/Dstaticforward=extern

wouldn't that work?

--Irmen

Jul 18 '05 #9
Irmen de Jong <irmen@-NOSPAM-REMOVETHIS-xs4all.nl> writes:
Syver Enstad wrote:
But Gerhard, what can I do? Every python extension that I will try

to
compile will fail if it depends on a working staticforward. The most

rational thing to me is to patch object.h instead of patching every
.cpp/.c file that needs this define.


Can't you just add a single compiler option (for cl.exe) to your
project?
/Dstaticforward=extern


Isn't it bad form to define a macro twice? This macro is alreay
defined in object.h, and we define it once again on the command
line.
--

Vennlig hilsen

Syver Enstad
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Brunel | last post by:
Hi all, We're trying to communicate with Microsoft Visual C++ 6.0 via COM to make it perform a few operations. Our main need is to set a breakpoint on a given line in a given file. We ended up...
2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
0
by: Leor Zolman | last post by:
The Intel C++ version of STLFilt (my STL Error Message Decryptor utility) has now been updated to support Intel C++ 8 (currently in Beta) along with version 7. All three MSVC libraries are...
2
by: Robert Oschler | last post by:
Need help with HEAP CORRUPTION and my MSVC 6 DLL I have a MSVC 6 DLL that I've written. It is used heavily by a Delphi 6 app I've written. For two months everything has been working fine. ...
8
by: Chris Stankevitz | last post by:
I can't tell you how frusterated I and my coworkers are with "MSVC 7.1 .net 2003" (what am I supposed to call this thing anyway?). Compiling and linking take twice as long with "MSVC 7.1 .net...
6
by: Uli | last post by:
Hello, I'm trying to use a DLL (by static linking) which was compiled with Borland C++Builder (BCB) in Visual C++ (Visual-Studio 2003). All functions are declared with the directive 'extern...
6
by: ma | last post by:
Hello, Some questions about upgrading to MSVC 2008. 1- I am using MSVC2005, Do you recommend that I upgrade to MSVC 2008 Beta 2? 2- When the MSVC2008 will be officially release? 3- Where...
17
by: fl | last post by:
Hi, I am learning C++ from the following C++ website, which has some very good small examples. For the second Fraction example, which has five files: Main.cpp Fraction.cpp Fraction.h...
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.