Your questions are more architectural than code related.
First, it's a meaty task to write a transpiler (the code which translates one language to another). Compiling C# on the fly is easy, though. You can use Roslyn for this. Check out this article for an awesome tutorial: http://www.tugberkugurlu.com/archive/compiling-c-sharp-code-into-memory-and-executing-it-with-roslyn.
The other problem comes next. Once you've got a DLL you'll need to load it into your main AppDomain. It's extremely easy as well. Just use Assembly.Load(...)
method. Here is some example: https://msdn.microsoft.com/en-us/library/25y1ya39(v=vs.110).aspx But you need to know once you've loaded you DLL into AppDomain, you can't unload it. If you don't use any tricks, you'll load your DLL into main AppDomain of your application. Then you'll not be able to get rid of it when you change code in your DLL. The only way is to close and start application again. Otherwise, you'll need to load your DLL into separate AppDomain.
Now, how to refer application functions. For this you'll need to create an interface
. Code your application functions in a class which conforms to the interface, and then pass instance of this class into your other class you load and instantiate from your dynamically loaded DLL.
Loading DLL as I described above, will do nothing useful. You need to create instances of classes from your DLL. For this you can use Activator.CreateInstance(...)
. As parameters to the class you about to create pass a class instance that conforms to an interface you created as above. For your reference this software development pattern is called "strategy".