Sigh... All this is driving me nuts. Thank you all for still replying despite my somewhat extremely complete and utter confusion on this matter. :?
Brace yourselves tho, it's getting worse. I've decided I need to start over from scratch to understand how to make my D3D(X) programs compile, link and run (with Wine) in Linux, as well as run in Windows without code changes.
In reply to Biplab:
1. From what I've read, the "self hosted MinGW version" will have the ability to link with a .dll/.lib pair created with MSVC, but I don't know which actual version that is (I'm using the one from Ubuntu repositories), nor am I certain that's true since every piece of documentation I've come across so far has been extremely confusing. Most of the FAQs or HowTo's I've come across are either exact copies or rewordings of the MinGW official FAQ, which in turn is IMHO gibberish.
The few texts I've found which I could make sense of says that to link with a Windows-dll, I need either a .lib-file (must be the one included with the 3rd party library, such as d3dx9.lib, righ? But you say that won't cut it because of incompatibilities) or an .a file, which I obviosly don't have since d3d's obviously been compiled for Windows with MSVC.
To create a .a file I need a .def file with all the symbols available in the .dll. Of course I don't have a .def file either.
To create a .def file I could use the .dll and the dllwrap tool. (Other tools like dlltool, libtool, nm are also mentioned for the various tasks needed to get the elusive .a file I need for linking, but the following "issues" apply to them as well) The .dll in my case would be d3dx9_xx.dll, right? I grabbed one (d3dx9_35.dll) from my Vista installation to test.
I have i586-mingw32msvc-dllwrap which came with MinGW, is this the tool they mean? I don't know what the actual difference is compared to just "dllwrap" (which I don't have). Some of the other tools I do have two versions of, the "regular" ones without "i586-mingw32msvc" and those with. What is what and why?
Anyway, I tried using i586-mingw32msv-dllwrap with the specified switches, but all it produced was an empty .def file and then said there were no symbols found.
I'm once again lost...
I tried an alternative route; find .a files someone else had already made for d3dx.
I came across this page:
http://mywebpage.netscape.com/PtrPck/directx.htm, where someone has made import libraries for d3dx8. Wrong version I know but I gave it a shot just to see what happened.
I added the new d3dx path to the Project's Search Directories -> Linker in CB to point to the files I downloaded from the above site and compiled.
Compile worked fine, and linking too (no segfault), except for a few undefined references to methods like _D3DXCreateEffectFromFileA@32 which I presume is because I used d3dx9 headers but only had the d3dx8 import library.
I tried to follow the guide on the link above to create import libraries for d3dx9 as well, but lost him when he mentions a tool called "reimp" which I don't have.
2. I don't know where that compiler option is set. I have not set it explicitly so I'm thinking it's somehow added by the D3D(X) headers.
The only reason I keep trying to do this is that I tell myself I'm learning something new, which I will benefit from greatly later on. But I will owe much of the effort to all of you who keep replying, so thank you all once again!