dub, ldc2, MS VS 2015, static c library

kinke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Dec 16 01:21:55 PST 2016


On Friday, 16 December 2016 at 07:41:31 UTC, dm wrote:
> On Friday, 16 December 2016 at 07:29:29 UTC, Nicholas Wilson 
> wrote:
>>>
>>> extern (C) int myFunc(int, int);
>>              ^^^
>> change this to extern(C++)
>>
>> Your lib is a C++ lib and (because you didn't make myFunc 
>> `extern "C"`) it has C++ name mangling (_Z6myFunciii or 
>> something like it). On the D side you said it was extern(C) 
>> (_myFunc) therefore the linker can't find the symbol because 
>> the names don't match.
>
> Doesn't works.

I guess dub doesn't forward the C++ lib to LDC. Try running it in 
verbose mode to check the command line. Linking manually without 
dub works, I assume.
Btw, I'd very much recommend upgrading your LDC to the latest 1.1 
beta, as there have been lots of bugfixes in the meantime, and it 
bundles DUB v1.1.1.


More information about the digitalmars-d-ldc mailing list