Why using wrappers for D?

Chalix via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 3 06:12:55 PDT 2016


On Monday, 3 October 2016 at 12:54:03 UTC, Adam D. Ruppe wrote:
> It is possible, you just need to match compilers with the 
> library in C++, whereas C libraries don't need such an exact 
> match.
>
> With your Qt library, you get a build of it that is compatible 
> with the compiler you use to build your application (either 
> compiling it yourself or getting it from an OS package repo 
> where they did it for you for your OS version)

Ah, so the Qt libraries are C++ libraries. And they have to be 
compiled with the same compiler (or at least with a compiler with 
the same specification) I use for my application? I didn't know 
that, but it makes sense to me.

But if there would be 2 C++ compilers on my linux system which 
create 2 different API's, I would need the Qt library twice on my 
system? One for an application compiled with the one compiler, 
and the other library for an application compiled with the other 
compiler. Since I have only 1 Qt library on my system, all linux 
compilers must create compatible API's, right?


> Wrap the C functions inside D classes. So they write D code 
> that calls the C functions, then you use their D code.

Ok, this is the same what cym13 wanted to say, right? So you can 
use the advantages of D?

But I don't get, why I have a gtkd-3 lib. Why can't I just link 
against the gtk-3 lib then? I have now the headers to use the 
nice D stuff, but the linking should be done against the 
C-compiled library.




More information about the Digitalmars-d-learn mailing list