Support compiling DLL assemblies

Basic changes to support building sources without PROGRAM entry points
as DLL assemblies that can be included in other .NET applications.