Re: Instantiate C struct on heap

2016-08-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 4 August 2016 at 21:02:59 UTC, TencoDK wrote: derelict/window.d (binding from C): struct sfWindow; That kind of struct isn't supposed to be created directly... there should be a create window function in the library somewhere.

Re: Instantiate C struct on heap

2016-08-04 Thread TencoDK via Digitalmars-d-learn
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: E

Re: Instantiate C struct on heap

2016-08-04 Thread TencoDK via Digitalmars-d-learn
On Thursday, 4 August 2016 at 21:21:14 UTC, Adam D. Ruppe wrote: On Thursday, 4 August 2016 at 21:02:59 UTC, TencoDK wrote: derelict/window.d (binding from C): struct sfWindow; That kind of struct isn't supposed to be created directly... there should be a create window function in the library

Re: Instantiate C struct on heap

2016-08-04 Thread Mike Parker via Digitalmars-d-learn
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: E

Re: Instantiate C struct on heap

2016-08-04 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 4 August 2016 at 23:49:26 UTC, Mike Parker wrote: C structs can be created with new just like D structs as long For clarity, in a D binding to a C library, a C struct *is* a D struct. If they are declared as extern(C), that affects the name of the symbol and how it exists in th