<div dir="ltr"><div dir="ltr"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 24, 2020 at 9:35 AM Ruby The Roobster via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Can you create a library(.lib) with ldc and port it to clang++?<br>
e.g.<br>
<br>
//test.d<br>
module test;<br>
import std.stdio;<br>
void hi()<br>
{<br>
writeln("hello");<br>
}<br>
<br>
//test.cpp(links to test.lib which contains test.hi<br>
#include <iostream><br>
extern "D" void hi();<br>
void main() {<br>
hi();<br>
}<br>
//Hopefully prints "hi"<br></blockquote><div><br></div><div>Of course. This is critically important functionality for many users.</div><div>Except, you should use `extern(C++)` in your D code, and no need to extern in your C++ code.</div></div></div>