Can't get D calling C to build.
Bob Cowdery
bob at bobcowdery.plus.com
Sat Aug 21 14:07:20 PDT 2010
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.
>> dmc gives me this error:
>> OPTLINK : Error 118: Filename Expected
>> LIB="C:\D2.0\dm\bin\..\lib";"C:\D2.0\dm\bin\..\mfc\lib";C:\Program
>> Files\Gtk+\lib
>>
>> The paths are correct as far as I can tell.
>>
>
> Optlink hates spaces in paths. It will also barf if you have spaces in
> any of the directories in the PATH environment var as well; you should
> setup an explicit PATH when running DMD.
>
> If you really need stuff with spaces in the name, you can use junction
> to create symlinks on 'doze and put the sym links in your path instead:
>
> http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
>
More information about the Digitalmars-d-learn
mailing list