fivemack: (Default)
Tom Womack ([personal profile] fivemack) wrote2003-11-26 10:18 pm

Dull stone knives and inadequately-tanned bearskins

I have three large programs on my computer, two of which cost Nottingham University fair sums of money, and all of which claim to be C++ compilers.

What I want is to do some fairly straightforward linear algebra (possibly later to be replaced by some vaguely-sophisticated sparse linear algebra), and display the results on the screen. If Python knew how to talk to DirectX, I would write it all in Python and I'd be finished by now.

But Python can't talk to DirectX, so I have to do it all in C++. And, whilst Python has good linear algebra libraries, C++ doesn't seem to; there's something called TNT from NIST which is incredibly primitive, and something called GMM++ from the University of Toulouse which looks as if it does everything I might want.

But it's written to compile under gcc-3.2. Whilst I have gcc-3.2, it doesn't know how to talk to DirectX either; and gcc-3.2, icc-7.1 and Visual Studio.NET (the three C++ compilers I have) clearly view the C++ standard in different ways, so a program that compiles under gcc needn't compile under any of the other compilers.

So I have spent the evening re-inventing the wheel (re-writing my perfectly good python code in C++), only to find that the wheel is incompatible with the track. It may just be that I'm a poor workman, to blame my tools at this length; I do have the reference books to build my own linear-algebra routines, but that would be a case of re-inventing the rock, let alone the wheel.

The lovely thing about Python was that its routines tended to work without vast expenditures of cursing; maybe it's unrealistic to expect other software to be that pleasant, but I can't convince myself, given that I've seen more than one reasonably happy professional programmer, that this level of unpleasantness is routinely endured by professional programmers. What am I doing wrong?

[identity profile] scottscidmore.livejournal.com 2003-11-26 03:04 pm (UTC)(link)
DirectX is a Microsoft product, it isn't expected to be nice with anything except other Microsoft products. With the Office products, you'd find that they would import from older, now obsolete, foreign products but not from current competitors; and would export to nothing useful.

You see any of theses, and did/do they help?

http://mywebpage.netscape.com/PtrPck/directx.htm

http://www.urebelscum.speedhost.com/mutliplemice.html

http://mail.gnu.org/archive/html/pingus-devel/2003-08/msg00010.html

http://www.flipcode.com/cgi-bin/msg.cgi?showThread=Tip-DXGCC&forum=totd&id=-1


http://pulp.fiction.net/~jeske/Projects/HZ/docs/windows_gcc_compile.html

[identity profile] arnhem.livejournal.com 2003-11-26 03:24 pm (UTC)(link)
Is there a particular reason to use DirectX rather than GL?

[identity profile] jojomojo.livejournal.com 2003-11-26 03:58 pm (UTC)(link)
What type of error messages do you see, precisely? If the library has GCC-isms in you're likely stuffed, but it may be relatively trivial to fix. And all three of those compilers are supposed to have good standards compliance, it's not like trying to make stuff work under, say, Visual Studio 6...

[identity profile] randwolf.livejournal.com 2003-11-26 06:21 pm (UTC)(link)
The license MS ships its headers under is incompatible with the GPL which gcc uses. I commend to your attention the -ansi option of g++ or better yet, std=c++98--that will probably restrict g++ to a compatible dialect. Would SDL (http://linux.oreillynet.com/pub/a/linux/2001/09/21/sdl.html) or OpenGL work for you? Does it have to be DirectX?
ext_8103: (Default)

licence

[identity profile] ewx.livejournal.com 2003-11-27 01:35 am (UTC)(link)
GCC output is not covered by the GPL, just the compiler itself

Re: licence

[identity profile] randwolf.livejournal.com 2003-11-27 03:12 pm (UTC)(link)
But the FSF cannot ship headers for DirectX, because, on the one hand, MS owns the rights and would not allow it and, on the other hand, all software the FSF ships is under the GPL. The FSF cannot even devise an alternate set of DirectX headers; they would be sued and would probably not win.
ext_8103: (Default)

Re: licence

[identity profile] ewx.livejournal.com 2003-11-27 03:15 pm (UTC)(link)
Why would they need to ship headers? Compare the situation with e.g. Gnu C running on Solaris, where the native headers are used.

Re: licence

[identity profile] randwolf.livejournal.com 2003-12-01 10:49 pm (UTC)(link)
[old business]

The DirectX headers aren't shipped with Windows; they're part of the DirectX SDK, which has to be licenced from MS.
ext_8103: (Default)

Re: licence

[identity profile] ewx.livejournal.com 2003-12-02 02:09 am (UTC)(link)
I'm having trouble seeing the relevance of this.

Re: licence

[identity profile] randwolf.livejournal.com 2003-12-02 12:25 pm (UTC)(link)
Oh, I see. No, there are also incompatibilities between the MS headers & libraries and gcc--it might be possible, but I sure wouldn't want to try it for a quick project. Search for "DirectX" here (http://www.mingw.org/), for more details.

[identity profile] rysmiel.livejournal.com 2003-11-27 06:32 am (UTC)(link)
Alas, this sounds like a level of unpleasantness encountered fairly often by this professional programmer.