www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - each extern (C) keyword causes ld (OS X) to add a duplicate library

Note the last two lines of this list (i am running OS X 10.10.2 
and Xcode 6.1.1):

clang -v -t cprog.c dprog.a -o cprog
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
  
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctool
hain/usr/bin/clang" 
-cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all 
-disable-free -disable-llvm-verifier -main-file-name cprog.c 
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim 
-masm-verbose -munwind-tables -target-cpu core2 
-target-linker-version 241.9 -v -resource-dir 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/
in/../lib/clang/6.0 
-fdebug-compilation-dir /Users/ernest/dev/inquiries/c_and_d 
-ferror-limit 19 -fmessage-length 146 -stack-protector 1 
-mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 
-fencode-extended-block-signature -fdiagnostics-show-option 
-fcolor-diagnostics -vectorize-slp -o 
/var/folders/gc/yfwyjyhn5b15xrsym2fyz6hr000327/T/cprog-897189.o 
-x c cprog.c
clang -cc1 version 6.0 based upon LLVM 3.5svn default target 
x86_64-apple-darwin14.1.0
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
  
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include
  
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
  /usr/include
  /System/Library/Frameworks (framework directory)
  /Library/Frameworks (framework directory)
End of search list.
  
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct
olchain/usr/bin/ld" 
-demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -t -o 
cprog 
/var/folders/gc/yfwyjyhn5b15xrsym2fyz6hr000327/T/cprog-897189.o 
dprog.a -lSystem 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a
/var/folders/gc/yfwyjyhn5b15xrsym2fyz6hr000327/T/cprog-897189.o
/usr/lib/libSystem.dylib
/usr/lib/system/libcache.dylib
/usr/lib/system/libcommonCrypto.dylib
...
dprog.a(dprog_1_487.o)
dprog.a(dprog_2_495.o)


cprog.c includes two symbols exported from dprog.a, which uses 
the extern(C) keyword on the two functions exported from dprog.a

when i remove one of the extern(C) keywords from dprog.a, ld 
lists only one dprog.a(dprog_x_x.o) at the end

should ld be listing multiple instances of dprog.a when dprog.a 
uses multiple extern C symbols?

i built dprog.a with dmd v2.066.1

i didnt include the listings to make this inquiry short, but i 
can add them if it would help (im new here, and i dont to annoy 
folks too much)
Feb 19 2015