Dynamic array of pointers to opaque structs
Johan F.
jaffe1 at gmail.com
Wed Jun 5 13:34:16 PDT 2013
I'm fiddling around with SDL2 using Derelict3, and I'm trying to
make an array of SDL_Texture pointers, like so:
SDL_Texture*[] frames;
... make texture ...
frames ~= texture;
However, this yields the following error:
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error: struct derelict.sdl2.types.SDL_Texture is forward
referenced when looking for 'toHash'
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error: struct derelict.sdl2.types.SDL_Texture is forward
referenced when looking for 'opCmp'
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error: struct derelict.sdl2.types.SDL_Texture is forward
referenced when looking for 'toString'
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error: struct derelict.sdl2.types.SDL_Texture unknown size
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error: struct derelict.sdl2.types.SDL_Texture no size yet for
forward reference
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error: struct derelict.sdl2.types.SDL_Texture unknown size
/Users/jaffe1/prog/Derelict3/import/derelict/sdl2/types.d(1865):
Error: struct derelict.sdl2.types.SDL_Texture no size yet for
forward reference
At line 1865 in types.d is the opaque struct declaration
struct SDL_Texture;
The program compiles and works fine if I change this line to
struct SDL_Texture {};
This seems weird to me. Why is making an array of _pointers_ to
SDL_Texture dependant on how the SDL_Texture struct is declared?
Also, is simply adding {} the right way of fixing it, or will
that possibly break something else?
More information about the Digitalmars-d
mailing list