##- # Author: Brian Tiffin # Dedicated to the public domain # # Date started: January 2017 # Modified: 2017-01-08/13:44-0500 ##+ # # unitcc.icn, demonstrate an embedded Tiny C compiler # # tectonics: # tcc -o unitcc.so unitcc.c -ltcc -L\usr\local\lib # procedure main() tcc := loadfunc("./unitcc.so", "unitcc") # compile some code with unitcc and pass an integer argument result := tcc( "int trytcc(int i) {\n_ printf(\"Hello, world\n\");\n_ return i*7;\n_ }", 6) # the inner trytcc function, compiled by tcc is invoked with arg write("result from tcc: ", result) end