bflattened / bflat

C# as you know it but with Go-inspired tooling (small, selfcontained, and native executables)
GNU Affero General Public License v3.0
3.62k stars 104 forks source link

API? #201

Open marss72 opened 3 months ago

marss72 commented 3 months ago

I have two questions. One is about whether the bflat compiler is standalone, and the second is about API.

  1. Is the bflat executable really standalone? So, can I automate the download in my app from this GitHub repo (from releases) and use the bflat executable from the compressed zip, without any other dependencies than everything inside the downloaded archive?
  2. Is there an API I could use in my app to better integrate with bflat? I'm able to use the Process.Start, but is there something, or some wrapper I could use?

Thanks!

MichalStrehovsky commented 3 months ago

Yes, it's standalone and shouldn't need anything. If you're on linux and need crypto APIs, you'll need libssl installed.

There's no API besides the command line interface of bflat.

marss72 commented 3 months ago

Thanks for your reply!

There's no API besides the command line interface of bflat.

Is there anything I could use to not write the C# script on the disk or the assembly on the disk? Like output/input redirection to bflat? I tried input redirection, but that did not work. I think this would be a great feature to add (reading C# script to compile from redirected input and possibly output, but that would introduce some problems with symbols file for example). If this would be added, one of the options to read from the redirected input would be to specify a specific input arg so for example $rinput <redirected_input>.

Thanks! I theoretically could be able to make a PR for that, but I don't want to break anything as I'm new to bflat.

MichalStrehovsky commented 3 months ago

I think the redirection should "just work".

I tried:

bflat build con -o test.exe
System.Console.WriteLine("Hello!");
^Z

And it worked for me on Windows. On Linux, I assume you'd use /dev/tty and whatever is the sequence to send EOF or something like that.