View previous topic :: View next topic |
Author |
Message |
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Tue Feb 12, 2008 11:34 pm Post subject: Tangobos compatibility |
|
|
There seems to be a problem using DFL in the same app as one that uses Tangobos. The trouble is linker errors over redefined Windows symbols.
Tangobos defines these in std/c/windows/windows.d and DFL redefines them in dfl/internal/_stdcwindows.d.
There are about two dozen redefined symbols reported. Here's one:
Code: |
const DWORD MAILSLOT_NO_MESSAGE = cast(DWORD)-1;
|
Now I'm not sure why these result in linker errors (seems like a linker bug) but they do. The sane-est workaround I can think of is to conditionalize the import of _stdcwindows.d in winapi.d like so:
Code: |
version(Tango)
{
version(PhobosCompatibility) {
public import std.c.windows.windows;
} else {
public import dfl.internal._stdcwindows;
}
private import dfl.internal.wincom;
}
else
{
...
}
|
It's not idea, though, because currently the PhobosCompatibilty isn't otherwise required for using Tangobos. I can't think of any other reasonable way to do it than with a version statement there.
After fixing that, There's also an issue with makelib.bat which assumes that building for Tango means including _stdcwindows.d.
Hmm, so I guess another ploy would be to put the version(PhobosCompatibility) into _stdcwindows.d, doing basically this:
Code: |
version(PhobosCompatibility) {
public import std.c.windows.windows;
}
else {
// ... current contents of file
}
|
Then makelib.bat can go on merrily doing what it does currently.
Still, there's an issue though. If you compile it in like that, it means the dfl lib will only be good for use with Tangobos.
Thoughts? |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Thu Feb 14, 2008 12:53 am Post subject: |
|
|
My conclusion after discussing things and filing various bug reports is that DFL should change the constants in its _stdcwindows.d to be either extern(D) or enums. For reference, Tango uses enums in their wrapping of the Windows constants.
If you make this change, then the constants defined in _stdcwindows can co-exist with those defined Phobos or Tangobos or somewhere else.
At least DWT would then cease to be part of the problem and instead become part of the solution.
This would also be fixed if Phobos/Tangobos changed their definitions, but hoping for Phobos to change is like hoping Giselle stops by your house in person. It may happen, but I wouldn't hold my breath waiting for it. |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Feb 18, 2008 2:33 am Post subject: |
|
|
I just addressed this in the latest snapshot. Let me know if you still have problems. |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Mon Feb 18, 2008 2:58 am Post subject: |
|
|
Chris Miller wrote: | I just addressed this in the latest snapshot. Let me know if you still have problems. |
So the idea is that one needs to build dfl with the -tangobos flag now? |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Feb 18, 2008 11:46 am Post subject: Re: -tangobos |
|
|
baxissimo wrote: | So the idea is that one needs to build dfl with the -tangobos flag now? | Yes, or -version=Tangobos if not using dfl command. |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Mon Feb 18, 2008 3:02 pm Post subject: Re: -tangobos |
|
|
Chris Miller wrote: | baxissimo wrote: | So the idea is that one needs to build dfl with the -tangobos flag now? | Yes, or -version=Tangobos if not using dfl command. |
That's what I was afraid of. I haven't tried it, but I assume what you did will work. However, I wish you would reconsider your solution. Tangobos shouldn't have to be something you have to think about using or not using in advance. It should just work when you need it. You shouldn't have to go back and recompile a bunch of libraries like DFL after you realize you want/need to use std.* in some project. Furthermore Tangobos isn't the only library that may conflict. Any library containing a port of std.windows stuff from Phobos will conflict. I know Schooner had its own copy for instance. I assume there are other copies in other projects floating around.
I'll push Gregor to make changes to Tangobos windows too. The issue there is that that Tangobos' windows.d file is an exact copy of Phobos' by design. That's the whole point of Tangobos. When/if Phobos ever changes its windows.d implementation, Tangobos will change as well. Anyway I had thought Gregor had gone inactive, but apparently he's moreso than I was thinking. |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Feb 18, 2008 5:45 pm Post subject: Re: -tangobos |
|
|
You're right, I just made the changes and it seems to work good. Let me know of any more problems, thanks |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Mon Feb 18, 2008 5:52 pm Post subject: Re: -tangobos |
|
|
Chris Miller wrote: | You're right, I just made the changes and it seems to work good. Let me know of any more problems, thanks |
Yah, seems to be working great! Thanks for making the change. Tangobos users can now rejoice. |
|
Back to top |
|
|
|