Fsi.exe Assembly: Does anyone know how to insert it?

Long reader, very first question. fsi.exe is executable .NET and therefore contains its own assembly complete with all yummy methods and whatnot fsi uses to execute F # scripts.

Look at the assembly in .NET Reflector (choose your class, but Shell is the best example) shows a bunch of garbage * names that look like decorated C ++ functions (say from Dependency Walker). By the way, and a little bit so, F # assemblies compile almost the same way, with a lot of garbage names *, which makes me think that fsi.exe is written in F #, perhaps as proof of usability?

In any case, here is my question: did anyone delve into fsi.exe and figure out how to embed it in a .NET application? Because I would like to use F # as a scripting language, but programs are compiled (unexpectedly), and fsi.exe should run scripts, which is unacceptable in my domain (I need a permanent virtual machine). I do not expect guidance on using fsi.exe, but I'm curious to know who he played with, and if so, what did you learn about how it works?

Thank you for your time.

* Trash at random. Obviously, they are formatted in this way for a specific reason, which is under the hood.

+6
source share
2 answers

As far as I know, fsi.exe does not provide an API that you could use to implement it in an application (for example, to implement scripts). I think there are two options:

  • If you want to use the existing fsi.exe directly, the only way is to start it using the .NET Process class and somehow contact it. This should be doable - you can send commands to the process using standard input. You can use standard output to read the output, but this only gives you limited information. It might be possible to use .NET Remoting to communicate between fsi.exe and your application (for example, your objects loaded into a script context in FSI would send information to your application via Remoting).

  • Another alternative is to use the open source version and modify fsi.exe to provide all the necessary information as an API. It takes a lot of effort to understand how fsi.exe works, but it should be doable. You probably don't need a lot of extras - the state supported by FSI contains things like global variables.

As for the license, you probably cannot use fsi.exe , which is distributed with Visual Studio. I am not sure about fsi.exe that comes with the CTP release. Compiling from the source (available here ) will definitely be fine (as it has an open source version).

+6
source
+1
source

All Articles