Why using wrappers for D?

Chalix via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 3 05:47:48 PDT 2016


On Monday, 3 October 2016 at 12:12:44 UTC, Adam D. Ruppe wrote:
> A lot of people like the wrappers as being prettier to use 
> since you can turn C functions into classes and such. gtkd is 
> an example of that.

Thanks for your fast answers :)

Hm, I thing I am missing some fundamentals...
I read a bit about creating libraries in C++, and I found out, 
this is not possible, because there is no definition of the API. 
So you need some C "factory methods" to load C++ classes.
So is it possible now by D to load a class directly, or what do 
you mean by "turn C functions into classes"?
Also, I used the Qt library a lot with C++. But although it is a 
library, I have access to all the classes, like " QWidget w = new 
QWidget();". There is no factory method used. (This confuses me 
now a bit...)

If its too much to explain within some sentences, maybe you know 
something where I could read more about it? I did not find 
anything myself. But I really want to understand what's going on.

> Of course, it is simple, just bring over the necessary struct, 
> constant, and function prototypes and it just works.

I have to try it :D


More information about the Digitalmars-d-learn mailing list