Instantiate C struct on heap

TencoDK via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 4 14:22:57 PDT 2016


On Thursday, 4 August 2016 at 21:02:59 UTC, TencoDK wrote:
> Hey,
>
> I'm using DerelictSFML2 + CSFML, I have stuck on instantiating 
> window.
>
> derelict/window.d (binding from C):
> struct sfWindow;
>
> my_file.d:
> sfWindow* sfmlWindow = null;
> sfmlWindow = new sfWindow; // ???
>
> This code snippet gives me:
> Error: struct derelict.sfml2.window.sfWindow unknown size
>
> How must I create stuctures from C bindings?

Looks like I found a solution. Too much C++ lately %)

sfmlWindow = sfWindow_create(
	sfVideoMode(800, 600),
         "Engine demo",
	sfTitlebar | sfClose,
	new sfContextSettings(	0, // depth bits
				0, // stencil bits
				0, // antialiasing
				4, // major
				3) // minor
);


More information about the Digitalmars-d-learn mailing list