View previous topic :: View next topic |
Author |
Message |
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri Jan 26, 2007 2:19 am Post subject: Bud compiled with GDC on Linux - possible problem |
|
|
In this thread, funsheep described how he compiled Bud with GDC and had a problem using it to build the Derelict libraries.
The problem turned out to be this:
Code: |
version(linux)
{
// blah
}
version(Unix)
{
// blah
}
|
For whatever reason, both blocks of code were being processed by the compiler. The obvious workarounds, of course, are to either add an 'else' in there (should have been there already) or, since the code is the same, to consolidate them. But, the issue still remains that both blocks were getting processed when they shouldn't have been since DMD doesn't recognize 'Unix' and GDC doesn't recognize 'linux'.
I don't know if this is an issue that arises from compiling Bud with GDC, a configuration problem with funsheep's system, or what. But I thought I'd bring it to your attention just in case. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
Carlos
Joined: 19 Mar 2004 Posts: 396 Location: Canyon, TX
|
Posted: Fri Jan 26, 2007 8:28 am Post subject: |
|
|
I think the solution would be something like:
Code: | version(linux)
version=linuxOrUnix;
version(Unix)
version=linuxOrUnix;
version(linuxOrUnix)
{
...
}
|
|
|
Back to top |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Fri Jan 26, 2007 10:46 am Post subject: Re: Bud compiled with GDC on Linux - possible problem |
|
|
aldacron wrote: |
For whatever reason, both blocks of code were being processed by the compiler. The obvious workarounds, of course, are to either add an 'else' in there (should have been there already) or, since the code is the same, to consolidate them. But, the issue still remains that both blocks were getting processed when they shouldn't have been since DMD doesn't recognize 'Unix' and GDC doesn't recognize 'linux'. |
I replied in the other thread, but might as well do it here too... GDC does recognize "linux", but it is true that DMD doesn't have the superset "Unix".
So if you compile the code above with GDC on Linux, it will do both blocks. And if you compile it on Mac OS X, it will only do the Unix one (not the linux) |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri Jan 26, 2007 12:06 pm Post subject: |
|
|
Carlos wrote: | I think the solution would be something like:
Code: | version(linux)
version=linuxOrUnix;
version(Unix)
version=linuxOrUnix;
version(linuxOrUnix)
{
...
}
|
|
Right, that's what I meant by 'consolidate'. But Anders pointed out that my understanding of GDC was flawed. So the issue was with the missing 'else' statement and not with Bud. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|