D and C APIs

Atla Neves via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 12 08:21:40 PST 2016


On Tuesday, 12 January 2016 at 12:56:39 UTC, bachmeier wrote:
> On Tuesday, 12 January 2016 at 10:43:40 UTC, Russel Winder 
> wrote:
>> D and Rust provide so many barriers to effective use of a C 
>> library, that I am resorting to using C++. Yes you have to do 
>> extra stuff to avoid writing C code, but nowhere near the 
>> amount you have to to create D and Rust adaptors.
>
> Sorry I can't offer any help, but I'm genuinely curious by what 
> you mean in this part of your quote. If the API is changing, 
> how does using C++, or for that matter C, help you? Sure, you 
> can include the header directly in your program, but don't you 
> still have to change your program? I must be missing something.

In C/C++, a change to the headers causes a recompilation which 
will fail if there are API changes. From any other language, 
it'll compile, link, and fail at runtime (unless the symbols 
change name). If you're lucky in an obvious way.

Atila



More information about the Digitalmars-d mailing list