digitalmars.D.learn - modules && type inheritance?
- MM (7/7) Jun 25 2006 I use derelics for my sdl/opengl application and I wanted to make one mo...
- BCS (14/23) Jun 26 2006 import the structures module in any module that will need to use them
- MM (12/25) Jun 26 2006 Thx for the reply, and sorry for my ambigious question :)
- BCS (4/42) Jun 26 2006 "structures.d" will need to import anything that it needs, so find which...
- MM (7/10) Jun 26 2006 Adding
- James Pelcis (3/5) Jun 26 2006 Personally, I would use the OpenGL types, but there isn't really a
I use derelics for my sdl/opengl application and I wanted to make one module to hold all my structures. I don't know much about scope and inheritance of types and thus don't know how to make this work :( In my structures I use the OpenGL types (GLubyte etc.) What do I have to do to make these types visible to other modules? Or.. where can I read about this :) btw. Is it really necessary to use the gl types iso d types?
Jun 25 2006
MM wrote:I use derelics for my sdl/opengl application and I wanted to make one module to hold all my structures. I don't know much about scope and inheritance of types and thus don't know how to make this work :( In my structures I use the OpenGL types (GLubyte etc.) What do I have to do to make these types visible to other modules? Or.. where can I read about this :) btw. Is it really necessary to use the gl types iso d types?import the structures module in any module that will need to use them <code name="structs.d"> struct foo{int i;} </code> <code name="other.d"> import structs; void main() { foo bar; bar.i = 3; return; } </code>
Jun 26 2006
import the structures module in any module that will need to use them <code name="structs.d"> struct foo{int i;} </code> <code name="other.d"> import structs; void main() { foo bar; bar.i = 3; return; } </code>Thx for the reply, and sorry for my ambigious question :) I import like this: import std.string; import std.c.stdio; import derelict.util.exception; import derelict.opengl.gl; import derelict.sdl.sdl; import derelict.sdl.image; import derelict.opengl.glu; import structures; And get this error: structures.d(19): identifier 'GLubyte' is not defined
Jun 26 2006
MM wrote:"structures.d" will need to import anything that it needs, so find which derelict import defines GLubyte and add an import line for it in structures.d.import the structures module in any module that will need to use them <code name="structs.d"> struct foo{int i;} </code> <code name="other.d"> import structs; void main() { foo bar; bar.i = 3; return; } </code>Thx for the reply, and sorry for my ambigious question :) I import like this: import std.string; import std.c.stdio; import derelict.util.exception; import derelict.opengl.gl; import derelict.sdl.sdl; import derelict.sdl.image; import derelict.opengl.glu; import structures; And get this error: structures.d(19): identifier 'GLubyte' is not defined
Jun 26 2006
"structures.d" will need to import anything that it needs, so find which derelict import defines GLubyte and add an import line for it in structures.d.Adding import derelict.opengl.gl; did the trick :) Note to self > Modules are no C Header files :D thx. Would you by chance know whether it is necessary/good programming to use the opengl types iso D types? :)
Jun 26 2006
MM wrote:Would you by chance know whether it is necessary/good programming to use the opengl types iso D types? :)Personally, I would use the OpenGL types, but there isn't really a difference.
Jun 26 2006