The initialization section calls InitThreadSynchronization, which amongst other things calls the following: SyncEvent := CreateEvent(nil, True, False, '') When you use the Forms unit, it has a dependency on the Classes unit. I've managed to track down the culprit (well at least one of them - there may be others). As I said in my comment, it's not 'invisible code', just code in the initialization section of some unit that's causing the problem.