ability to make a DLL

See #302
This commit is contained in:
Andrew Kelley
2017-10-16 01:14:28 -04:00
parent 78b753af9d
commit d08c57741a
7 changed files with 62 additions and 15 deletions

View File

@@ -372,6 +372,7 @@ static void construct_linker_job_coff(LinkJob *lj) {
// how to handle --target-environ gnu
// These comments are a clue
bool is_library = g->out_type == OutTypeLib;
//bool dll = g->out_type == OutTypeLib;
//bool shared = !g->is_static && dll;
//if (g->is_static) {
@@ -422,13 +423,19 @@ static void construct_linker_job_coff(LinkJob *lj) {
//lj->args.append(get_libc_static_file(g, "crtbegin.o"));
} else {
lj->args.append("-NODEFAULTLIB");
if (g->have_winmain) {
lj->args.append("-ENTRY:WinMain");
} else {
lj->args.append("-ENTRY:WinMainCRTStartup");
if (!is_library) {
if (g->have_winmain) {
lj->args.append("-ENTRY:WinMain");
} else {
lj->args.append("-ENTRY:WinMainCRTStartup");
}
}
}
if (is_library && !g->is_static) {
lj->args.append("-DLL");
}
for (size_t i = 0; i < g->lib_dirs.length; i += 1) {
const char *lib_dir = g->lib_dirs.at(i);
lj->args.append(buf_ptr(buf_sprintf("-LIBPATH:%s", lib_dir)));