One small step for Mikey-kind (One ever-so-tiny leap for OpenGL-ctypes)

I've just now managed to get GLUT to load on Linux using ctypes. It turns out that GLUT requires the use of the "RTLD_GLOBAL" flag when loading GL and GLU so that it can resolve its references to those libraries. At the moment ctypes doesn't support passing in the flag, but with a patch to allow it I can get GLUT to load (yay!)

Why did it take me so long to figure this out?

Because I was focussing on GLUT, assuming that there was something wrong with it. The approach was reinforced by various posts suggesting that you had to muck about with the order of linking flags to get GLUT to load (silly C people) which had me trying to figure out how to duplicate that solution in Python with dynamic loading (e.g. building a trivial DLL wrapping GLUT, GL and GLU).

It wasn't until this evening that I thought to look up the documentation for dlopen and realised that this was just a matter of a missing flag. It then made sense; the C people were just creating a dependency relationship (a before b) while assuming that the global flag was active in their environments (which I guess it is, given that the reordering worked for them). The symptoms were the same, and it's the same root problem (needing a way to get at the symbols at GLUT load-time), but it was a different proximate cause.

Anyway, I think I'll watch Doctor Who and then head off to bed early. I've had enough of programming for the night.


Comments are closed.


Pingbacks are closed.