State of interfacing with c++

Johan Engelen via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 19 03:52:35 PDT 2016


On Saturday, 19 March 2016 at 08:10:41 UTC, Johan Engelen wrote:
> On Friday, 18 March 2016 at 20:47:41 UTC, Walter Bright wrote:
>> On 3/18/2016 6:59 AM, Johan Engelen wrote:
>>> It'd be nice to be able to call `dmd -ldflags` whose output 
>>> would be the
>>> standard linker flags.
>>
>>   dmd -v file.d
>>
>> will tell you what command is sent to the linker.
>
> That linker command does not include the path to phobos.
> You would have to parse the output, etc...

Would you accept a PR that adds `dmd -ldflags` ?

For C++/D linking, I used the C++ linker for LDC (master), but 
now I am changing it to using the D compiler with "-L-lstdc++" to 
link. It solves the issue of finding the location of 
phobos/druntime (different for dmd and ldc) and other required 
libs for D code. It also solves a Windows-specific linking 
problem when main() is in C++ code [1].

[1] 
http://forum.dlang.org/post/livbjrlaoliqjtmmwnht@forum.dlang.org



More information about the Digitalmars-d mailing list