void _static_library(string ofiles, string library)
{
    if (!exists(library) || g_compiled)
    {
        run("ar r " + library + " " + ofiles);
        run("ranlib " + library);
        run("rm " + ofiles);
    }
}

void makeLibrary(string oDstDir, string library)
{
    int index;

    g_compiled = 0;
    
    md(oDstDir);
                                                // compile all files
    for (index = g_nClasses; index--; )
        std_cpp(oDstDir, index, g_classes[index], library);     // ./stdcpp

                                            // make the library
    _static_library(oDstDir + "/*.o", library);
}
