Thread overview | |||||
---|---|---|---|---|---|
|
June 11, 2008 chmod and chown in D | ||||
---|---|---|---|---|
| ||||
Hi all i am trying out gdc and the d lang. Does anyone know how to fix chmod and chown c has sys/stat.h but i don't understand how i can fix chmod in d I want to make a chmod program in D regards /J3nkl3r |
June 11, 2008 Re: chmod and chown in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to J3nkl3r | J3nkl3r wrote: > Hi all > i am trying out gdc and the d lang. Does anyone know how to fix chmod and chown > c has sys/stat.h but i don't understand how i can fix chmod in d > > I want to make a chmod program in D > > regards > /J3nkl3r The alternative community developed runtime library Tango has a module for sys/stat.h. http://www.dsource.org/projects/tango/docs/current/tango.stdc.posix.sys.stat.html http://www.dsource.org/projects/tango/wiki/Download |
June 12, 2008 Re: chmod and chown in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | Jacob Carlborg wrote: > J3nkl3r wrote: >> Hi all >> i am trying out gdc and the d lang. Does anyone know how to fix chmod and chown >> c has sys/stat.h but i don't understand how i can fix chmod in d >> >> I want to make a chmod program in D >> >> regards >> /J3nkl3r > > The alternative community developed runtime library Tango has a module for sys/stat.h. > > http://www.dsource.org/projects/tango/docs/current/tango.stdc.posix.sys.stat.html > > http://www.dsource.org/projects/tango/wiki/Download For those who are interested in how you go about doing it or yourself sys/stat is a fairly simple example to use to describe the process :) So, have a look at the tango source itself: http://www.dsource.org/projects/tango/browser/trunk/tango/stdc/posix/sys/stat.d You'll see that in general if you want to access C functions in D you need to define them in a D module using "extern (C)". You need to define any structures they use, constant values they use, and either import definitions for types they use or define them yourself. You get all this information from the C headers, you can generally copy/paste into your D module and then get it working with often only minor changes. Regan Heath |
Copyright © 1999-2021 by the D Language Foundation