set mode directly on DoMain
build as shared library