www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compile time filesystem access?

reply Manu <turkeyman gmail.com> writes:
--0023544717e4f4518a04b7bebe84
Content-Type: text/plain; charset=UTF-8

Is D capable of accessing the filesystem at compile time, for instance, to
load and parse an XML DOM, or some other structural metadata, which may be
used to generate the associative struct and its members?
I can think of many other uses for the technology too. It seems extremely
powerful, and I'm sure it's been discussed :)

--0023544717e4f4518a04b7bebe84
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Is D capable of accessing the filesystem at compile time, for instance, to =
load and parse an XML DOM, or some other structural metadata, which may be =
used to generate the associative struct and its members?<div>I can think of=
 many other uses for the technology too. It seems extremely powerful, and I=
&#39;m sure it&#39;s been discussed :)</div>

--0023544717e4f4518a04b7bebe84--
Jan 30 2012
next sibling parent reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:
 Is D capable of accessing the filesystem at compile time, for 
 instance, to
 load and parse an XML DOM, or some other structural metadata, 
 which may be
 used to generate the associative struct and its members?
 I can think of many other uses for the technology too. It seems 
 extremely
 powerful, and I'm sure it's been discussed :)

That's what the import("filename") expression is for: http://dlang.org/expression.html#ImportExpression You'll need to approve paths for inclusion with the -J switch.
Jan 30 2012
next sibling parent David Nadlinger <see klickverbot.at> writes:
Be careful, though, the import expression (understandably) expects a 
compile-time string, which means that you can't directly use it from 
CTFE (e.g. to open additional files included by the IDL file you are 
parsing), but instead have to go back to compile-time land and then pass 
the contents back to CTFE in convoluted ways…

David



On 1/30/12 2:41 PM, Manu wrote:
 On 30 January 2012 15:30, Vladimir Panteleev
 <vladimir thecybershadow.net <mailto:vladimir thecybershadow.net>> wrote:

     On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:

         Is D capable of accessing the filesystem at compile time, for
         instance, to
         load and parse an XML DOM, or some other structural metadata,
         which may be
         used to generate the associative struct and its members?
         I can think of many other uses for the technology too. It seems
         extremely
         powerful, and I'm sure it's been discussed :)


     That's what the import("filename") expression is for:
     http://dlang.org/expression.__html#ImportExpression
     <http://dlang.org/expression.html#ImportExpression>

     You'll need to approve paths for inclusion with the -J switch.


 Magic! :)

Jan 30 2012
prev sibling next sibling parent bls <bizprac orange.fr> writes:
On 01/30/2012 07:18 AM, Adam D. Ruppe wrote:
 On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:
 I want to know if a library is present, and automatically disable
 non-vital features if it isn't.

I'd like it too... here's what I tried. It doesn't work, though.

I am afraid I miss the point but shouldn't module ctors help.. f.i. module m; import std.file; static this() // module ctor { if ("/usr/share/include/my.lib".isDir) import my; else import other; } Not tested!
Jan 30 2012
prev sibling next sibling parent David Nadlinger <see klickverbot.at> writes:
On 1/30/12 3:24 PM, Manu wrote:
 Here's another one I'm endlessly wishing I had in C.
 I want to know if a library is present, and automatically disable
 non-vital features if it isn't.
 It shits me to tears when I can't build something because a non-vital
 dependant lib is not available for a given platform or just not wanted.

This could be an option, if it worked: http://d.puremagic.com/issues/show_bug.cgi?id=7399 David
Jan 30 2012
prev sibling next sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 01/30/2012 04:18 PM, Adam D. Ruppe wrote:
 On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:
 I want to know if a library is present, and automatically disable
 non-vital features if it isn't.

I'd like it too... here's what I tried. It doesn't work, though. === void libraryTest(string lib)() { mixin("import " ~ lib ~ ";"); } template libraryExists(string lib) { enum libraryExists = __traits(compiles, libraryTest!lib()); } void main() { static if(libraryExists!"arsd.cgi") { import arsd.cgi; auto cgi = new Cgi(); cgi.write("hello w/ cgi"); } else { import std.stdio; writeln("hello w/ stdio"); } } === That's the idea, but I couldn't get it to actually work. Imports are apparently done by the compiler before anything else (which makes sense, really) and that breaks the if compiles thing; it fails before it gets there. If you move the libraryTest inline to the compiles thing, it never uses the lib, so that's no good either. Alas.

The fact that this does not work is a compiler bug: static if(is(typeof({import asdf;}))){} it fails with exit code 1 without spitting out an error message. Once that is fixed, it could be used to detect presence or absence of a library. http://d.puremagic.com/issues/show_bug.cgi?id=7399
Jan 30 2012
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-01-30 18:48, Manu wrote:
 On 30 January 2012 19:30, Marco Leise <Marco.Leise gmx.de
 <mailto:Marco.Leise gmx.de>> wrote:

     Am 30.01.2012, 15:24 Uhr, schrieb Manu <turkeyman gmail.com
     <mailto:turkeyman gmail.com>>:

         Here's another one I'm endlessly wishing I had in C.
         I want to know if a library is present, and automatically
         disable non-vital
         features if it isn't.
         It shits me to tears when I can't build something because a
         non-vital
         dependant lib is not available for a given platform or just not
         wanted.


     A library is some .dll/.so in this case ?
     If you know it exists only on a certain platform: use version(Platform)
     If it _may_ be there, then compile the feature in, but load and
     check the library at runtime like you would do with a plugin.


 I'm talking about static libs, since you need to link the supporting
 code for DLL's anyway.

     This sounds like what has been solved with configure scripts long
     ago. If you ever built e.g. GDC or most other Linux programs, they
     come with a little script that allows you to preconfigure your build
     process and takes care of linking to the different available libraries.


 Configure scripts certainly don't 'solve' the problem, they make it
 worse... now my buildscript has twice as many steps, nobody can
 understand it, and it only works on linux.

             ./configure --disable-libDontUseMe

     I never wrote one myself though...


 Exactly, and nobody I've ever met has either. They just seem to exist,
 magically appeared out of nowhere in all major linux projects that have
 existed for 20 years or so. As far as I can tell, nobody ACTUALLY wrote
 them, they've just always been there... ;)

Aren't those configure scripts generate by some other tool :) -- /Jacob Carlborg
Jan 30 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--0022158c0d411acccb04b7bf0036
Content-Type: text/plain; charset=UTF-8

On 30 January 2012 15:30, Vladimir Panteleev <vladimir thecybershadow.net>wrote:

 On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:

 Is D capable of accessing the filesystem at compile time, for instance, to
 load and parse an XML DOM, or some other structural metadata, which may be
 used to generate the associative struct and its members?
 I can think of many other uses for the technology too. It seems extremely
 powerful, and I'm sure it's been discussed :)

That's what the import("filename") expression is for: http://dlang.org/expression.**html#ImportExpression<http://dlang.org/expression.html#ImportExpression> You'll need to approve paths for inclusion with the -J switch.

Magic! :) --0022158c0d411acccb04b7bf0036 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On 30 January 2012 15:30, Vladimir Panteleev <sp= an dir=3D"ltr">&lt;<a href=3D"mailto:vladimir thecybershadow.net">vladimir = thecybershadow.net</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quot= e" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"HOEnZb"><div class=3D"h5">On Monday, 30 January 2012 at 13:23= :19 UTC, Manu wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> Is D capable of accessing the filesystem at compile time, for instance, to<= br> load and parse an XML DOM, or some other structural metadata, which may be<= br> used to generate the associative struct and its members?<br> I can think of many other uses for the technology too. It seems extremely<b= r> powerful, and I&#39;m sure it&#39;s been discussed :)<br> </blockquote> <br></div></div> That&#39;s what the import(&quot;filename&quot;) expression is for:<br> <a href=3D"http://dlang.org/expression.html#ImportExpression" target=3D"_bl= ank">http://dlang.org/expression.<u></u>html#ImportExpression</a><br> <br> You&#39;ll need to approve paths for inclusion with the -J switch.<br> </blockquote></div><br><div>Magic! :)</div> --0022158c0d411acccb04b7bf0036--
Jan 30 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--20cf300faaf15a048004b7bf9ae2
Content-Type: text/plain; charset=UTF-8

On 30 January 2012 15:41, Manu <turkeyman gmail.com> wrote:

 On 30 January 2012 15:30, Vladimir Panteleev
<vladimir thecybershadow.net>wrote:

 On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:

 Is D capable of accessing the filesystem at compile time, for instance,
 to
 load and parse an XML DOM, or some other structural metadata, which may
 be
 used to generate the associative struct and its members?
 I can think of many other uses for the technology too. It seems extremely
 powerful, and I'm sure it's been discussed :)

That's what the import("filename") expression is for: http://dlang.org/expression.**html#ImportExpression<http://dlang.org/expression.html#ImportExpression> You'll need to approve paths for inclusion with the -J switch.

Magic! :)

Here's another one I'm endlessly wishing I had in C. I want to know if a library is present, and automatically disable non-vital features if it isn't. It shits me to tears when I can't build something because a non-vital dependant lib is not available for a given platform or just not wanted. --20cf300faaf15a048004b7bf9ae2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On 30 January 2012 15:41, Manu <span dir=3D"ltr"=
&lt;<a href=3D"mailto:turkeyman gmail.com">turkeyman gmail.com</a>&gt;</sp=

border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"HOEnZb"><div class=3D"h5"><div class=3D"gmail_quote">On 30 Ja= nuary 2012 15:30, Vladimir Panteleev <span dir=3D"ltr">&lt;<a href=3D"mailt= o:vladimir thecybershadow.net" target=3D"_blank">vladimir thecybershadow.ne= t</a>&gt;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> <div><div>On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> Is D capable of accessing the filesystem at compile time, for instance, to<= br> load and parse an XML DOM, or some other structural metadata, which may be<= br> used to generate the associative struct and its members?<br> I can think of many other uses for the technology too. It seems extremely<b= r> powerful, and I&#39;m sure it&#39;s been discussed :)<br> </blockquote> <br></div></div> That&#39;s what the import(&quot;filename&quot;) expression is for:<br> <a href=3D"http://dlang.org/expression.html#ImportExpression" target=3D"_bl= ank">http://dlang.org/expression.<u></u>html#ImportExpression</a><br> <br> You&#39;ll need to approve paths for inclusion with the -J switch.<br> </blockquote></div><br></div></div><div>Magic! :)</div> </blockquote></div><br><div>Here&#39;s another one I&#39;m endlessly wishin= g I had in C.</div><div>I want to know if a library is present, and automat= ically disable non-vital features if it isn&#39;t.</div><div>It shits me to= tears when I can&#39;t build something because a non-vital dependant lib i= s not available for a given platform or just not wanted.</div> --20cf300faaf15a048004b7bf9ae2--
Jan 30 2012
prev sibling next sibling parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
Hear hear! How I understand what you mean!
"I just wanna freakin' look at it, but build a legitimate magical
mystery toy with endless possibilities!"

On Mon, Jan 30, 2012 at 6:24 PM, Manu <turkeyman gmail.com> wrote:
 On 30 January 2012 15:41, Manu <turkeyman gmail.com> wrote:
 On 30 January 2012 15:30, Vladimir Panteleev <vladimir thecybershadow.net>
 wrote:
 On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:
 Is D capable of accessing the filesystem at compile time, for instance,
 to
 load and parse an XML DOM, or some other structural metadata, which may
 be
 used to generate the associative struct and its members?
 I can think of many other uses for the technology too. It seems
 extremely
 powerful, and I'm sure it's been discussed :)

That's what the import("filename") expression is for: http://dlang.org/expression.html#ImportExpression You'll need to approve paths for inclusion with the -J switch.

Magic! :)

Here's another one I'm endlessly wishing I had in C. I want to know if a library is present, and automatically disable non-vital features if it isn't. It shits me to tears when I can't build something because a non-vital dependant lib is not available for a given platform or just not wanted.

-- Bye, Gor Gyolchanyan.
Jan 30 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:
 I want to know if a library is present, and automatically 
 disable non-vital features if it isn't.

I'd like it too... here's what I tried. It doesn't work, though. === void libraryTest(string lib)() { mixin("import " ~ lib ~ ";"); } template libraryExists(string lib) { enum libraryExists = __traits(compiles, libraryTest!lib()); } void main() { static if(libraryExists!"arsd.cgi") { import arsd.cgi; auto cgi = new Cgi(); cgi.write("hello w/ cgi"); } else { import std.stdio; writeln("hello w/ stdio"); } } === That's the idea, but I couldn't get it to actually work. Imports are apparently done by the compiler before anything else (which makes sense, really) and that breaks the if compiles thing; it fails before it gets there. If you move the libraryTest inline to the compiles thing, it never uses the lib, so that's no good either. Alas.
Jan 30 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--20cf300faaf118bc0004b7c16264
Content-Type: text/plain; charset=UTF-8

On 30 January 2012 18:11, bls <bizprac orange.fr> wrote:

 On 01/30/2012 07:18 AM, Adam D. Ruppe wrote:

 On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:

 I want to know if a library is present, and automatically disable
 non-vital features if it isn't.

I'd like it too... here's what I tried. It doesn't work, though.

I am afraid I miss the point but shouldn't module ctors help.. f.i. module m; import std.file; static this() // module ctor { if ("/usr/share/include/my.lib".**isDir) import my; else import other; } Not tested!

That looks like a runtime test, and would still require both libs being present to link. I'm talking about detection at compile time. For example, I have a sound API here atm, the it supports mp3, vorbis, flac, wma, etc, but not all of those libraries are available for all platforms I build for. What I need to do is know in advance what platforms have which libs available, and then do a bunch of platform checks to decide which should or shouldn't be present. Further more, if a lib is *available* for a given platform, but I don't want to use it, or don't want to install/build the lib, I need to edit the code... If I could detect presence of the lib, I can just gracefully remove the feature. --20cf300faaf118bc0004b7c16264 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On 30 January 2012 18:11, bls <span dir=3D"ltr">= &lt;<a href=3D"mailto:bizprac orange.fr">bizprac orange.fr</a>&gt;</span> w= rote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde= r-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im">On 01/30/2012 07:18 AM, Adam D. Ruppe wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> I want to know if a library is present, and automatically disable<br> non-vital features if it isn&#39;t.<br> </blockquote> <br> I&#39;d like it too... here&#39;s what I tried. It doesn&#39;t<br> work, though.<br> </blockquote> <br></div> I am afraid I miss the point but shouldn&#39;t module ctors help.. f.i.<br> <br> module m;<br> import std.file;<br> static this() =C2=A0// module ctor<br> {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (&quot;/usr/share/include/my.lib&quot;.<u></= u>isDir)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0import my;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0else<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0import other;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<br> }<br> <br> Not tested!<br> </blockquote></div><br><div>That looks like a runtime test, and would still= require both libs being present to link. I&#39;m talking about detection a= t compile time.</div><div><br></div><div>For example, I have a sound API he= re atm, the it supports mp3, vorbis, flac, wma, etc, but not all of those l= ibraries are available for all platforms I build for.</div> <div>What I need to do is know in advance what platforms have which libs av= ailable, and then do a bunch of platform checks to decide which should or s= houldn&#39;t be present.</div><div>Further more, if a lib is *available* fo= r a given platform, but I don&#39;t want to use it, or don&#39;t want to in= stall/build the lib, I need to edit the code... If I could detect presence = of the lib, I can just gracefully remove the feature.</div> --20cf300faaf118bc0004b7c16264--
Jan 30 2012
prev sibling next sibling parent "Marco Leise" <Marco.Leise gmx.de> writes:
Am 30.01.2012, 15:24 Uhr, schrieb Manu <turkeyman gmail.com>:

 Here's another one I'm endlessly wishing I had in C.
 I want to know if a library is present, and automatically disable  
 non-vital
 features if it isn't.
 It shits me to tears when I can't build something because a non-vital
 dependant lib is not available for a given platform or just not wanted.

A library is some .dll/.so in this case ? If you know it exists only on a certain platform: use version(Platform) If it _may_ be there, then compile the feature in, but load and check the library at runtime like you would do with a plugin. This sounds like what has been solved with configure scripts long ago. If you ever built e.g. GDC or most other Linux programs, they come with a little script that allows you to preconfigure your build process and takes care of linking to the different available libraries. ./configure --disable-libDontUseMe I never wrote one myself though...
Jan 30 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--20cf3074d792e42ada04b7c27540
Content-Type: text/plain; charset=UTF-8

On 30 January 2012 19:30, Marco Leise <Marco.Leise gmx.de> wrote:

 Am 30.01.2012, 15:24 Uhr, schrieb Manu <turkeyman gmail.com>:

  Here's another one I'm endlessly wishing I had in C.
 I want to know if a library is present, and automatically disable
 non-vital
 features if it isn't.
 It shits me to tears when I can't build something because a non-vital
 dependant lib is not available for a given platform or just not wanted.

A library is some .dll/.so in this case ? If you know it exists only on a certain platform: use version(Platform) If it _may_ be there, then compile the feature in, but load and check the library at runtime like you would do with a plugin.

I'm talking about static libs, since you need to link the supporting code for DLL's anyway. This sounds like what has been solved with configure scripts long ago. If
 you ever built e.g. GDC or most other Linux programs, they come with a
 little script that allows you to preconfigure your build process and takes
 care of linking to the different available libraries.

Configure scripts certainly don't 'solve' the problem, they make it worse... now my buildscript has twice as many steps, nobody can understand it, and it only works on linux. ./configure --disable-libDontUseMe
 I never wrote one myself though...

Exactly, and nobody I've ever met has either. They just seem to exist, magically appeared out of nowhere in all major linux projects that have existed for 20 years or so. As far as I can tell, nobody ACTUALLY wrote them, they've just always been there... ;) --20cf3074d792e42ada04b7c27540 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On 30 January 2012 19:30, Marco Leise <span dir= =3D"ltr">&lt;<a href=3D"mailto:Marco.Leise gmx.de">Marco.Leise gmx.de</a>&g= t;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0= .8ex;border-left:1px #ccc solid;padding-left:1ex"> Am 30.01.2012, 15:24 Uhr, schrieb Manu &lt;<a href=3D"mailto:turkeyman gmai= l.com" target=3D"_blank">turkeyman gmail.com</a>&gt;:<br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div class=3D"im"> Here&#39;s another one I&#39;m endlessly wishing I had in C.<br></div><div = class=3D"im"> I want to know if a library is present, and automatically disable non-vital= <br> features if it isn&#39;t.<br></div><div class=3D"im"> It shits me to tears when I can&#39;t build something because a non-vital<b= r> dependant lib is not available for a given platform or just not wanted.<br> </div></blockquote> <br> A library is some .dll/.so in this case ?<br> If you know it exists only on a certain platform: use version(Platform)<br> If it _may_ be there, then compile the feature in, but load and check the l= ibrary at runtime like you would do with a plugin.<br></blockquote><div><br=
</div><div>I&#39;m talking about static libs, since you need to link the s=

<div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex= ;border-left:1px #ccc solid;padding-left:1ex">This sounds like what has bee= n solved with configure scripts long ago. If you ever built e.g. GDC or mos= t other Linux programs, they come with a little script that allows you to p= reconfigure your build process and takes care of linking to the different a= vailable libraries.<br> </blockquote><div><br></div><div>Configure scripts certainly don&#39;t &#39= ;solve&#39; the problem, they make it worse... now my buildscript has twice= as many steps, nobody can understand it, and it only works on linux.</div> <div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex= ;border-left:1px #ccc solid;padding-left:1ex">=C2=A0 =C2=A0 =C2=A0 =C2=A0./= configure --disable-libDontUseMe<br> <br> I never wrote one myself though...<br> </blockquote></div><br><div>Exactly, and nobody I&#39;ve ever met has eithe= r. They just seem to exist, magically appeared out of nowhere in all major = linux projects that have existed for 20 years or so. As far as I can tell, = nobody ACTUALLY wrote them, they&#39;ve just always been there... ;)</div> --20cf3074d792e42ada04b7c27540--
Jan 30 2012
prev sibling next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 30 January 2012 17:48, Manu <turkeyman gmail.com> wrote:
 On 30 January 2012 19:30, Marco Leise <Marco.Leise gmx.de> wrote:
 Am 30.01.2012, 15:24 Uhr, schrieb Manu <turkeyman gmail.com>:

 Here's another one I'm endlessly wishing I had in C.
 I want to know if a library is present, and automatically disable
 non-vital
 features if it isn't.
 It shits me to tears when I can't build something because a non-vital
 dependant lib is not available for a given platform or just not wanted.

A library is some .dll/.so in this case ? If you know it exists only on a certain platform: use version(Platform) If it _may_ be there, then compile the feature in, but load and check th=


 library at runtime like you would do with a plugin.

I'm talking about static libs, since you need to link the supporting code for DLL's anyway.
 This sounds like what has been solved with configure scripts long ago. I=


 you ever built e.g. GDC or most other Linux programs, they come with a
 little script that allows you to preconfigure your build process and tak=


 care of linking to the different available libraries.

Configure scripts certainly don't 'solve' the problem, they make it worse=

 now my buildscript has twice as many steps, nobody can understand it, and=

 only works on linux.

 =A0 =A0 =A0 =A0./configure --disable-libDontUseMe

 I never wrote one myself though...

Exactly, and nobody I've ever met has either. They just seem to exist, magically appeared out of nowhere in all major linux projects that have existed for 20 years or so. As far as I can tell, nobody ACTUALLY wrote them, they've just always been there... ;)

Much like my book about the paranormal... I didn't buy, it just appeared in my room one night. --=20 Iain Buclaw *(p < e ? p++ : p) =3D (c & 0x0f) + '0';
Jan 30 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--00235452fe24162bc804b7c2f751
Content-Type: text/plain; charset=UTF-8

On 30 January 2012 20:03, Iain Buclaw <ibuclaw ubuntu.com> wrote:

 On 30 January 2012 17:48, Manu <turkeyman gmail.com> wrote:
 Exactly, and nobody I've ever met has either. They just seem to exist,
 magically appeared out of nowhere in all major linux projects that have
 existed for 20 years or so. As far as I can tell, nobody ACTUALLY wrote
 them, they've just always been there... ;)

Much like my book about the paranormal... I didn't buy, it just appeared in my room one night.

Precisely! :P --00235452fe24162bc804b7c2f751 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On 30 January 2012 20:03, Iain Buclaw <s= pan dir=3D"ltr">&lt;<a href=3D"mailto:ibuclaw ubuntu.com">ibuclaw ubuntu.co= m</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margi= n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"HOEnZb"><div class=3D"h5">On 30 January 2012 17:48, Manu &lt;= <a href=3D"mailto:turkeyman gmail.com">turkeyman gmail.com</a>&gt; wrote:<b= r>&gt; Exactly, and nobody I&#39;ve ever met has either. They just seem to = exist,<br> &gt; magically appeared out of nowhere in all major linux projects that hav= e<br> &gt; existed for 20 years or so. As far as I can tell, nobody ACTUALLY wrot= e<br> &gt; them, they&#39;ve just always been there... ;)<br> <br> </div></div>Much like my book about the paranormal... =C2=A0I didn&#39;t bu= y, it just<br> appeared in my room one night.<br></blockquote><div><br></div><div>Precisel= y! :P</div></div> --00235452fe24162bc804b7c2f751--
Jan 30 2012
prev sibling next sibling parent "Marco Leise" <Marco.Leise gmx.de> writes:
 Aren't those configure scripts generate by some other tool :)

Maybe. I never digged that deep into build processes. After some time I got myself to write Makefiles, but that's about it. I see names like automake, m4, configure etc. pop up now and then and have no idea what role each plays. They just get the job done somehow and check which C standard library is used, what compiler and other useful traits to cover the differences between systems.
Jan 30 2012
prev sibling next sibling parent Danni Coy <danni.coy gmail.com> writes:
--f46d0447f2a6b1504a04b7c3ef72
Content-Type: text/plain; charset=ISO-8859-1

configure scripts are usually part of the automake build system which used
to be the standard on linux maybe 5 years ago I think it went out of favour
roughly the same time as cvs.

On Tue, Jan 31, 2012 at 5:29 AM, Marco Leise <Marco.Leise gmx.de> wrote:

 Aren't those configure scripts generate by some other tool :)

Maybe. I never digged that deep into build processes. After some time I got myself to write Makefiles, but that's about it. I see names like automake, m4, configure etc. pop up now and then and have no idea what role each plays. They just get the job done somehow and check which C standard library is used, what compiler and other useful traits to cover the differences between systems.

--f46d0447f2a6b1504a04b7c3ef72 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable configure scripts are usually part of the automake build system which used = to be the standard on linux maybe 5 years ago I think it went out of favour= roughly the same time as cvs.<br><br><div class=3D"gmail_quote">On Tue, Ja= n 31, 2012 at 5:29 AM, Marco Leise <span dir=3D"ltr">&lt;<a href=3D"mailto:= Marco.Leise gmx.de">Marco.Leise gmx.de</a>&gt;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div class=3D"im"><blockquote class=3D"gmail= _quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:= 1ex"> Aren&#39;t those configure scripts generate by some other tool :)<br> </blockquote> <br></div> Maybe. I never digged that deep into build processes. After some time I got= myself to write Makefiles, but that&#39;s about it. I see names like autom= ake, m4, configure etc. pop up now and then and have no idea what role each= plays. They just get the job done somehow and check which C standard libra= ry is used, what compiler and other useful traits to cover the differences = between systems.<br> </blockquote></div><br> --f46d0447f2a6b1504a04b7c3ef72--
Jan 30 2012
prev sibling parent "Peter Alexander" <peter.alexander.au gmail.com> writes:
On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:
 Is D capable of accessing the filesystem at compile time, for 
 instance, to
 load and parse an XML DOM, or some other structural metadata, 
 which may be
 used to generate the associative struct and its members?
 I can think of many other uses for the technology too. It seems 
 extremely
 powerful, and I'm sure it's been discussed :)

As interesting as that would be, I wouldn't recommend it. Just generate a .d file from the XML before compiling. It will be faster, and more flexible than trying to hit everything with the D hammer.
Jan 30 2012