register_function requires a dll entry point and you cannot generate that in managed code.
You can write a C++/CLi wrapper DLL to have native entry points for your managed code but if you are just starting from scratch then why not just write a plain native dll.