did I give you my Lemon Kittens CD?

I used to have a copy of the Lemon Kittens CD "We Buy a Hammer for Daddy". It's terrible, and I gave it away several years ago, but now I know someone else who is looking for a copy. Problem is, I can't for the life of me remember who I gave it to, and it wasn't any of the usual suspects.

Was it you?

The fact that I can't remember who I gave it to is driving me crazy, because I used to have a good memory. Oh, time's remorseless arrow!

(Incidentally, anyone have a copy of "Jesus Egg That Wept"?)

Tags: ,

address spaces and bad craziness

I have a .saver bundle. It gets dynamically loaded and run by either my test harness, or by the actual screen saver framework. In the former case, it works fine; in the latter case it blows up. This seems to have something to do with static variables getting reset to their default state instead of the values they had been set to. I'm very puzzled, and I don't really understand how dynamic loading of bundles works on this system. Here's what I've got:

ScreenSaverView.m: init() calls yarandom.c: ya_rand_init(). Then it calls dangerball.c: screenhack(), which later calls yarandom.c: ya_random(). ScreenSaverView.m is ObjC, everything else is C.

So I've sprinkled some test code around. It looks like this: In yarandom.c I've got:

    static unsigned int bad_craziness = 0xABCD1234;
    void TEST (void) {
      if (bad_craziness != 0xDEADBEEF) abort();

    ya_rand_init (unsigned int seed)
      bad_craziness = 0xDEADBEEF;

Every call to TEST() made from ScreenSaverView.m after calling ya_rand_init() succeeds. In particular: it calls TEST() then immediately calls screenhack(). The very first line in screenhack() is a call to TEST() which fails, because bad_craziness is 0xABCD1234 instead of 0xDEADBEEF. The value appears to change back to its previous value halfway through setting up the stack frame.

So maybe what's going on is not that it's getting reset, but that somehow there are two copies of the yarandom.o code loaded, and different ones are being seen by the two files? (Update: yes.) But they were all loaded together from the same .saver bundle.

W, I must ask, TF?

Tags: , , ,