...and it's not meant for plugins but for using the engine dll in C++. I misread somewhere something it seems... grin

Actually you don't need a toggle bool (the engine takes care of returning 0 on close events) - but you have to setup all your code below this while, which is your main loop.
So you can as well go for a while(bla) {dll_call(); wait(1);} grin