[DDMD] [refactor] Move Module::toCBuffer and genhdrfile into free functions