HigherOrderCO / Bend

A massively parallel, high-level programming language
https://higherorderco.com
Apache License 2.0
16.98k stars 413 forks source link

Request: Compile hvm programs to C libraries #434

Open n6garcia opened 2 months ago

n6garcia commented 2 months ago

I am trying to use bend to make c code that I can call within C++ but there is no option to compile programs with no main (as libraries)

developedby commented 2 months ago

Although this is not directly supported at the moment, it is trivially easy to modify the generated C program to not have a main function. Just remove the definition of WITH_MAIN at the beginning and manually call hvm_c like the main function does right now (you can check at the end of the generated file). hvm-c doesn't receive arguments right now, so I don't know how useful that would be, but you can totally do it