www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking against clang produced libs on OSX

reply "Hagen" <hagen.kaiser me.com> writes:
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
Feb 01 2013
parent reply Jacob Carlborg <doob me.com> writes:
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
Feb 01 2013
parent "Hagen" <hagen.kaiser me.com> writes:
Hi

Thank you for your help.
I wrapped some functions of Qt.
After updating to Qt5.0.1 it suddenly worked.

The lib is c++. Its probably a bit simple. but good to know that 
there is no problem with clang and dmd interop so far.

thx
Feb 02 2013