Compile and link C/C++ libs automatically
    Mike Parker 
    aldacron at gmail.com
       
    Thu Dec  3 06:13:10 UTC 2020
    
    
  
On Thursday, 3 December 2020 at 05:08:55 UTC, RSY wrote:
> Hello
>
> I tried zig for few days last month, it was pretty fun, but D 
> still remains my main language, zig is way too much restrictive 
> and verbose..
>
> However, one feature that is making me very jealous was the 
> ability to compile c/c++ code and automatically link the lib, 
> and cache all that
>
> This made working with C libraries MUCH easier
>
> Since both zig and LDC are based on clang, i was wondering if 
> the same could be possible with LDC?
LDC is not "based on clang". It's a D frontend to LLVM, whereas 
clang is a C frontend to LLVM.
Personally, I don't find it very practical to maintain a 
multi-language compiler. If the Zig developers think it's the way 
to go, more power to them. But this is the sort of thing that 
should be relegated to build tools. Should we have support for 
compiling C and C++ in dub? Absolutely (you can do it now to a 
limited degree with prebuild commands). But not built into the D 
compiler. It should be configurable (gcc vs ldc vs msvc) just as 
dub allows you to choose your D compiler.
You might find dpp of interest. While it doesn't compile C or 
C++, it does allow you to include C  and (to a limited degree) 
C++ headers in your D code without the need to create bindings.
https://github.com/atilaneves/dpp
    
    
More information about the Digitalmars-d
mailing list