The Reluctant C Programmer

chromatic on 2004-01-01T08:45:21

I consider myself a good programmer. I'm best at Perl, though I've programmed Java, various shells, JavaScript, PHP, and VBScript for money and C and C++ on a handful of free software projects. That doesn't count being able to read and evaluate examples in other languages such as Python, Ruby, and occasionally Smalltalk, playing with several varieties of BASIC in the '80s for learning purposes, dabbling in a few assembly languages, and reading some slightly more esoteric stuff 'cuz it's interesting.

Still, faced with a problem, I reach for Perl or, in small doses, the shell.

Having too much time on my hands, as it would seem, I find myself maintaining a large chunk of XS code. XS itself isn't too bad. It's not pretty, but if you don't need complex wrappers (and if someone's already written your typemap), it's fairly sane.

I've never liked the compile and link cycle in C, though. Getting the include paths correct — in the right order — is always a chore, for some reason. When that finally works, getting the library paths right is just as difficult.

With XS, you also have to make DynaLoader happy. All I can say is, "I hope I'm doing this wrong, because if I'm doing it correctly, yuck!"

Oh, and the problem I haven't quite solved is how to produce several individual shared libraries from one distribution. Recursive makefiles? No thank you. I'd really love to be able to do this from Module::Build, as MakeMaker — while venerable and a very important part of the process, historically speaking — is just... well, I'd almost rather make users write XML to configure the build. Almost.

Nevertheless, I present to you SDL Perl Snapshots. The only one there right now is SDL::OpenGL, but it compiles, links, and passes the tests on Linux PPC. It doesn't autodetect include paths, which is likely the next step, and the test suite does little more than check that it loads and defines at least one interesting constant.

They pass, though, which is more than I had yesterday. That's progress and I'll take it.