Sometimes computers do astonishingly baffling things, like when a compiler that has otherwise behaved properly goes quietly bonkers.
I have a niche specialty converting paleolithic DOS database applications to Windows. (“DOS?”, you say. Yes, DOS. Trust me, there are still zillions of these applications out there, often doing mission-critical things.)
A conversion I’m doing uses a third-party library of modem functions. No biggie, just link it in. Except, this library requires validation with a key code. Again, usually no biggie, except that it validates the key code correctly the first time then rejects it after that. Huh? I tried every possible permutation of code, de-installed and re-installed everything multiple times, and nothing worked. Even the developer of the modem library was stumped. He sent special versions with extra debug code in it, and nothing helped.
He was using xBase++ to compile and link. I’m using Harbour. Both are Clipper compatible, the language the original app is written is, use the same data files, and are assumed to be mostly interchangeable. Except when they aren’t.
When he compiled in xBase++, it worked fine. When he compiled in Harbour he got the same error I was getting. After much gnashing of teeth, it appears Harbour was somehow for some reason loading his DLL twice, which clobbered internal variables including the key code.
Ouch, this makes my brain hurt…