         { [ dup windows? ] [ drop ".dll" ] }
     } cond ;
 
-: library-path ( str -- str' )
-    '[ "lib" % _ % library-suffix % ] "" make temp-file ;
-
-: src-suffix ( lang -- str )
-    {
-        { C [ ".c" ] }
-        { C++ [ ".cpp" ] }
-    } case ;
+: library-path ( str -- path )
+    '[ "lib" % _ % library-suffix % ] "" make inline-library-file ;
 
 HOOK: compiler os ( lang -- str )
 


:: link-object ( lang args name -- )
    args name [ library-path ]
    [ ".o" append temp-file ] bi 2array
    lang link-command try-process ;

:: compile-to-library ( lang args contents name -- )
    lang contents name compile-to-object

    { "-g" "-prebind" "-dynamiclib" "-o" }
    cpu x86.64? [ { "-arch" "x86_64" } prepend ] when ;

<PRIVATE
: src-suffix ( lang -- str )
    {
        { C [ ".c" ] }
        { C++ [ ".cpp" ] }
    } case ;

: link-command ( args in out lang -- descr )
    [ 2array ] dip compiler-descr link-descr
    append prepend prepend ;

:: compile-to-object ( lang contents name -- )
    name ".o" append temp-file
