www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Is it possible to create a library with ldc and port it to LLVM

reply Ruby The Roobster <michaeleverestc79 gmail.com> writes:
Can you create a library(.lib) with ldc and port it to clang++?
e.g.

//test.d
module test;
import std.stdio;
void hi()
{
writeln("hello");
}

//test.cpp(links to test.lib which contains test.hi
#include <iostream>
extern "D" void hi();
void main() {
hi();
}
//Hopefully prints "hi"
Sep 23 2020
parent reply Johan <j j.nl> writes:
On Wednesday, 23 September 2020 at 22:59:25 UTC, Ruby The 
Roobster wrote:
 Can you create a library(.lib) with ldc and port it to clang++?
 e.g.

 //test.d
 module test;
 import std.stdio;
 void hi()
 {
 writeln("hello");
 }

 //test.cpp(links to test.lib which contains test.hi
 #include <iostream>
 extern "D" void hi();
 void main() {
 hi();
 }
 //Hopefully prints "hi"
See https://stackoverflow.com/questions/26923976/calling-a-d-function-directly-from-c
Sep 23 2020
parent Ruby The Roobster <michaeleverestc79 gmail.com> writes:
On Wednesday, 23 September 2020 at 23:31:49 UTC, Johan wrote:
 See
 https://stackoverflow.com/questions/26923976/calling-a-d-function-directly-from-c
Thanks.
Sep 23 2020