www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - header filed functions

reply MM <MM_member pathlink.com> writes:
I just got d to run the opengl example (from the very nice Dmedia website)
Simple things like where to place build and what to put in my path were the most
difficult for me as I used to always use a nice IDE for my C programs.
(Now I only need to make everything work without dmd having to sit in my root :)

but here my question:
I used to always put all my functions in separate header files to make everthing
clean (this works in an ide)

now what is the best way to keep all my functions neat and ordered in D.. or
should I just do what I used to do?

thx
May 09 2006
next sibling parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
MM wrote:
 I just got d to run the opengl example (from the very nice Dmedia website)
 Simple things like where to place build and what to put in my path were the
most
 difficult for me as I used to always use a nice IDE for my C programs.
 (Now I only need to make everything work without dmd having to sit in my root
:)
 
 but here my question:
 I used to always put all my functions in separate header files to make
everthing
 clean (this works in an ide)
 
 now what is the best way to keep all my functions neat and ordered in D.. or
 should I just do what I used to do?
 
 thx
 
 
you don't need header, just import the .d file that contains the function you want. import module_name; just note: the module name is not exactly the file name. (it doesn't include the .d extension)
May 10 2006
prev sibling parent Deewiant <deewiant.doesnotlike.spam gmail.com> writes:
MM wrote:
 now what is the best way to keep all my functions neat and ordered in D.. or
 should I just do what I used to do?
 
You can declare them before defining them, just like in C, if you want to. This should work both with a separate module for them (the "header") and by writing them in the same module. However, the general style seems to be to just define them as you go.
May 10 2006