Resolved (not corrected) compilation errors on Linux/GCC/Mono

This commit makes code compile on Linux with GCC and Mono. Some of the bugs
are simply commented and need to be properly fixed. Search for FIXME
comments to find such places.

This wasn't tested back on Windows/.NET again. May be broken.