diff --git a/changelog/rdmd_shared.dd b/changelog/rdmd_shared.dd index 4242240b2..3bc6f8a4b 100644 --- a/changelog/rdmd_shared.dd +++ b/changelog/rdmd_shared.dd @@ -1,3 +1,3 @@ rdmd supports `-shared` -rdmd now understands DMD's `-shared` switch, and sets the default output file name appropriately (`.dll` or `so` depending on the platform), in the same way as `-lib`. +rdmd now understands DMD's `-shared` switch, and sets the default output file name appropriately (`.dll`, `.so`, or `.dylib` depending on the platform), in the same way as `-lib`. diff --git a/rdmd.d b/rdmd.d index 5eeb373c8..442ddd5f5 100755 --- a/rdmd.d +++ b/rdmd.d @@ -27,7 +27,10 @@ version (Posix) enum objExt = ".o"; enum binExt = ""; enum libExt = ".a"; - enum dllExt = ".so"; + version (OSX) + enum dllExt = ".dylib"; + else + enum dllExt = ".so"; enum altDirSeparator = ""; } else version (Windows) @@ -367,7 +370,7 @@ size_t indexOfProgram(string[] args) { auto arg = args[i]; if (!arg.startsWith('-', '@') && - !arg.endsWith(".obj", ".o", ".lib", ".a", ".dll", ".so", ".def", ".map", ".res") && + !arg.endsWith(".obj", ".o", ".lib", ".a", ".dll", ".so", ".dylib", ".def", ".map", ".res") && args[i - 1] != "--eval") { return i; @@ -634,7 +637,7 @@ private string[string] getDependencies(string rootModule, string workDir, string[] names = [libName ~ ".lib"]; else { - string[] names = ["lib" ~ libName ~ ".a", "lib" ~ libName ~ ".so"]; + string[] names = ["lib" ~ libName ~ ".a", "lib" ~ libName ~ ".so", "lib" ~ libName ~ ".dylib"]; dirs ~= ["/lib", "/usr/lib"]; } foreach (dir; dirs)