Different versions of MSVC have different versions of STL

Something that I have only recently noticed only after I have used MSVC for a while is that different versions of MSVC use different versions of the C++ standard template library. This isn’t a problem, unless you are linking libraries statically that were built with different versions of MSVC. For example, a static library that uses the STL built with MSVC 2003 would not be linkable with a program built with MSVC 2005 without a considerable amount of dicking around.

This is weird, because the STL is meant to be portable and make programs portable. It appears that Microsoft’s STL are not only a set of headers, but also a corresponding set of libraries that contain a set of functions that are used by the STL.

If you attempt to link a library built with a version of MSVC with a program built with another version of MSVC, the compiler will complain because it is unable to find references to the functions the library’s version of the STL calls.

The obvious way around this would be to link all the libraries the library depends on into itself, but that would cause problems with compiling with the same version of MSVC, and even more so when you are using static libraries that were all compiled with different versions of MSVC.

Usually you wouldn’t worry about this unless you are creating libraries to be used by other people, or using libraries written by other people. I wonder what Microsoft has against one STL to rule them all? So how do we get around this? Easy answer: You don’t use the STL.

Shaders, where math meets art

Since playing with shaders is so much fun, lets have a little fun looking at what happens when you take an old game, and breathe some new life into it using a crazily reprogrammed pipeline:

Vertex Buffer Objects

In my last post I mentioned that if you wanted to draw a large number of things on a screen, you need VBOs. Well, honestly at the time, I only knew what it was but never touched it before. VBOs are Vertex Buffer Objects, in other words, boxes in the GPU to store vertices, their colors, normals and attributes. After a considerable amount of Googling, I was finally able to learn what VBOs are and relate them to the intermediate mode. This would probably help those who have started openGL by learning glBegin and glEnd learn about what VBOs truly are, and why they exist.

Read more

Playing with GLSL

After puzzling some time over the tutorials in Lighthouse3D, I finally learned how to prepare a GLSL shader and use it in an OpenGL render. In the beginning I thought a shader could be used on a particular set of vertices and fragments. However, it turned out that the shader was run every frame on every vertex and fragment you gave OpenGL to use. This meant that if you made a simple fragment shader that coloured the current fragment red, then everything you draw on the screen will be red. It turns out the shader replaces the so-called fixed-functionality in the rendering pipeline, which is basically a little assembly line where all the vertices and colours given to the video card gets processed. So instead of having the workers work their normal routine, a shader tells them what to do instead. To be honest I felt a little disappointed since I could not write something like actionscript would allow me to do, but I guess that is just because it isn’t meant to be actionscript.

Read more

Reset

I never seem to be satisfied with any of the sites I made, so I made myself swear that this is the last time I’m going to replace the Labs site. The last one was a bit of a joke anyway. If you ever have a choice, Drupal 6 isn’t exactly a good CMS for building production sites, unless you have got plenty of in-house expertise. When you have to spend a whole day messing around with it to get it to let you post just one blog post, perhaps it just isn’t built to write posts.

So the difference is, yes I have moved down to the Wordpress side to avoid the grief that comes with Drupal. I have decided that hacking something that works well is easier that hacking something that is borked. So I have decided that I will hack this. Woot. Now back to coding.

FireStats icon Powered by FireStats