Linking against clang produced libs on OSX

Jacob Carlborg doob at me.com
Fri Feb 1 07:13:14 PST 2013


On 2013-02-01 15:07, Hagen wrote:
> Hi all,
>
> 1. I made a static lib in C++ using the Lion standard compilers.
> 2. I made a static lib using dmd (which calls the C++ lib)
> 3. I made a testprogram that links against both libs
>
> I get this answer from dmd:
> Undefined symbols for architecture x86_64:
>    "createQuicked()", referenced from:
>        _D7quicked12_staticCtor1FZv in libRCF.a(quicked.o)
> ld: symbol(s) not found for architecture x86_64
> collect2: ld returned 1 exit status
>
> Now the question:
> Is it possible to use libs that have been compiled using the new clang
> based compilers on OSX from dmd?
> Or is maybe something wrong in the scenario above?
> Do I have f.e. to declare the c++ interface code in the main program?
>
> thx in advance
>   hagen

It should work. DMD is compatible with GCC and Clang is compatible GCC 
so it should work. This is true for at least C, I'm not sure about C++. 
Are both the D and C++ code compiled for the same architecture?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list