Extensions to types loaded from a C library

Jacob Carlborg doob at me.com
Sat Dec 15 03:22:52 PST 2012


On 2012-12-15 07:26, Jeremy DeHaan wrote:

> Thus it appears that any extensions made to the types defined in a C
> library is not safe! Even one as trivial as a constructor. I didn't show
> the code or output(it was with some different tests), but I also got
> some run time errors when using the version of sfVector2f at the top
> which went away when I changed it back to the original code.

For that simple constructor there is no need to defined one. This works 
just as good:

struct sfVector2f
{
     float x;
     float y;
}

sfVector2f newPosition = sfVector2f(100,200);

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list