Can't get D calling C to build.

Bob Cowdery bob at bobcowdery.plus.com
Sun Aug 22 12:37:26 PDT 2010


 On 22/08/2010 00:54, div0 wrote:
> On 21/08/2010 22:07, Bob Cowdery wrote:
>>   On 20/08/2010 18:44, div0 wrote:
>>> On 20/08/2010 09:17, Bob Cowdery wrote:
>>>>
>>>> I'm still concerned it's a bit too soon as a lot of things seem to be
>>>> either Windows or Linux (cmake says its only tested for *nix) but not
>>>> both and there is very little guidance on building. I really want
>>>> to get
>>>> this working on Windows first. As D makes so much of its binary
>>>> compatibility with C I find it odd that there is no information on how
>>>> to build mixed systems just on how to code the calls.
>>>
>>> C compatibly is fine as long as you either build with dmc
>>> or convert the VC c libs to dmc's format. The conversion tool is only
>>> available as part of the paid tool set off of digital mars I think;
>>> though possibly there's a free one around.
>>>
>>> Try searching the learn archive it's been discussed before.
>>>
>>> Personnaly I just compile stuff with dmc and it all works great as
>>> long as you get the extern c declarations right.
>>>
>> I have compiled all my stuff now with dmc. It has some differences from
>> gcc which caused me some issues. I then went to link up my program with
>> a D front end and realised that I use many 3rd party libraries which
>> will all need to be converted.  This doesn't seem like such a great idea
>> any more. Why does a modern language use an old object format I wonder.
> >
>> For me at least I'm wondering if it stacks up. Linux support seems
>> secondary (correct me if I'm wrong). The only painless way to use C
>> libraries is as dll's and even then the import library must be converted
>> for which the tool in not free. The language itself is nice but the
>> hassle factor for mixed language multi-platform seems quite high. I hope
>> I'm wrong on both counts.
>
> Well that's true; D still isn't really ready for production use,
> unless you have time or money to burn to do a lot of it yourself.
>
> I love D, but I only use it for my own small hobby projects.
>
> Mr B has stated though that once d2 is wrapped up (which should be
> just about now) he's going to start concentrating on the tool chain,
> so these sorts of issues I expect will get much better over the next 6
> months.
>
Thanks, that's an honest opinion. The first project I have in mind is a
personal one but it's quite large. My hope would be to move a lot of the
C code into D eventually. I don't think I would risk it on a commercial
project until the toolchain is sorted and its a bit more mature.


More information about the Digitalmars-d-learn mailing list