My copy of Visual C++ 6 pro this finally arrived last week, and much jubilation was had by me, and those who were glad I was finally using that instead of the non-standard Borland C++ Builder 3.0. As much as I complain about BCB3, it served me well and was incredibly easy to use.
I installed VisualC++ 6.0 on Thursday, and after finishing brushing up for my Physics assesment, I decided to port my OpenGL based 3d Transform driver / Renderer over. It was about 8pm. I got the DLL workspace together, and shock horror, I recieved 300 odd errors. After a few twiddles with the project settings (which I should have done first) I got rid of those, and moved on to linker errors, of which there were about 1000, from the way I dynamically loaded OGL. Sigh.
Friday night late I got on to the OGL linker errors. I first switched to using an import library, just to see if those were the only linker errors. I eventually got that dynamic linking again by slightly changing the file configuration, and introducing the old method I used in LCC, which was using a header file with all the OGL calls externed. It worked straight away.
Then Saturday night late, I got on to porting the 2d driver. I put together the project file, and even with the old method of loading OGL, I found it worked. It worked with the old method of loading OGL, because the 2d driver does not yet include the font or bitmap code, which means it is basically one file which sets up the window or the screen state. That was good.
Then very late Saturday night, I got on to the sample application, which basically initialised the 2d driver, got it to pull up a window (you can set colour bits, z-bits, resolution and fullscreen/windowed) that was OGL friendly and ready to go, initialised the 3d driver, including the geometry memory manager, OGL, GLU etc. Then it de-initialised both.
I got it compiling first time round, no errors, no warnings. Amazing how you learn :) But, then I found that the 2d and 3d driver dlls wouldn't load. I spent Sunday night fixing that. I tried everything I could. It turned out that VC was mangling the exported names (used Borland's IMPDEF style utility). To remedy that problem, I put together a DEF file again using Borlands IMPDEF utility, but this time on the old Borland compiled DLL, with non-mangled names. That seemingly de-mangled the file names. Still, I got errors. Then I realised that I was compiling all the DLLs with __cdecl function calls. Switching to __stdcall it all worked perfectly.
In case your wondering, I normally do all my coding late at night on the weekend. I'm doing some today on Monday in the morning, because I don't have school today (Educator's education day, when all the boffins get together, and further the scholastic technocracy which is the Education system).
Today, I worked out the bugs in the 3d driver. There seems to be none I can find (knock on wood) in the 2d driver. The first problem was an annoying mistake. When I switched to static OpenGL linking, to get the thing to compile first time, I commented out the GLU and OGL dll loading routines from the renderer init procedure. Sigh, and I wondered where all problems were coming from. I sorted it out, and everything seems to be back to where it was under Borland, but with hopefully a lack of bugs, because while getting the 3d driver to work I noticed some errors I had made. I have gone through every line now, and it seems everything is going like it should. So no I have to finish the level compiler, finish the lighting and lightmap handling routines, finish the multi-texture version of the renderer, and hopefully I'll be able to put together a nice demo.
I hope this helps anyone wondering about their DLL errors... Oh, and by the way, the Borland binarys and VC binarys are interchangable now, which is always a good sign.
Oh, and I drafted three docs on some worldspace visibility algorithms I worked out. A few people have the drafts, and the comments seem to be good. I'll try and finalise them and present them properly this week, and get them to Kurt or upload them to my homepage.
Conor "DirtyPunk" Stokes