mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-02 18:43:14 +01:00
Added -shared switch.
If the flag is passed, ldc will create a shared library not an executable file.
This commit is contained in:
18
gen/main.cpp
18
gen/main.cpp
@@ -391,7 +391,13 @@ int main(int argc, char** argv)
|
||||
if (!global.params.obj || !global.params.output_o || createStaticLib)
|
||||
global.params.link = 0;
|
||||
|
||||
if (global.params.link)
|
||||
if (createStaticLib && createSharedLib)
|
||||
error("-lib and -shared switches cannot be used together");
|
||||
|
||||
if (createSharedLib && mRelocModel == llvm::Reloc::Default)
|
||||
mRelocModel = llvm::Reloc::PIC_;
|
||||
|
||||
if (global.params.link && !createSharedLib)
|
||||
{
|
||||
global.params.exefile = global.params.objname;
|
||||
if (files.dim > 1)
|
||||
@@ -649,6 +655,14 @@ LDC_TARGETS
|
||||
fatal();
|
||||
}
|
||||
|
||||
if (global.params.os == OSWindows) {
|
||||
global.dll_ext = "dll";
|
||||
global.lib_ext = "lib";
|
||||
} else {
|
||||
global.dll_ext = "so";
|
||||
global.lib_ext = "a";
|
||||
}
|
||||
|
||||
// added in 1.039
|
||||
if (global.params.doDocComments)
|
||||
VersionCondition::addPredefinedGlobalIdent("D_Ddoc");
|
||||
@@ -1034,7 +1048,7 @@ LDC_TARGETS
|
||||
else
|
||||
{
|
||||
if (global.params.link)
|
||||
status = linkObjToExecutable(global.params.argv0);
|
||||
status = linkObjToBinary(createSharedLib);
|
||||
else if (createStaticLib)
|
||||
createStaticLibrary();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user