Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla

Bug 44

Summary: MinGW: Add support for D fibers.
Product: GDC Reporter: Benjamin Thaut <code>
Component: libgdruntimeAssignee: Daniel Green <venix1>
Status: RESOLVED FIXED    
Severity: major CC: ibuclaw, venix1
Priority: ---    
Version: development   
Hardware: All   
OS: MinGW   

Description Benjamin Thaut 2013-03-17 19:42:15 CET
On windows the "naked" GCC attribute is needed for the fiber_switchContext function inside core.traits. Without it fibers won't correctly work.
Comment 1 Benjamin Thaut 2013-03-17 19:44:01 CET
I meant "core.threads" instead of "core.traits"
Comment 2 Iain Buclaw 2013-03-17 19:48:06 CET
Nope, someone just needs to implement a generic version for Windows.  We don't use IASM implementations.
Comment 3 Benjamin Thaut 2013-03-17 19:54:51 CET
What do you mean by "generic version" ? The fibers which are offered by the WinAPI are not a suiteable replacement.
Comment 4 Daniel Green 2013-03-17 21:18:48 CET
GCC doesn't do naked outside of ARM, AVR, MCORE, RX and SPU.  http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

There are two solutions to this that don't involve using the WinAPI.  The first is rewriting the fiber implementation to not need naked.  

Or putting the switchContext function into an external file as done on some systems.

  version( AsmExternal )
    extern (C) void fiber_switchContext( void** oldp, void* newp );

Working fiber code for that function should be in the mingw repo.  It's just disabled as I never got around to externalizing it.  I won't get around to it until I finish getting GDC working with 4.8.0.

Going to update this title to properly reflect what needs to happen.
Comment 5 Iain Buclaw 2015-07-03 11:55:29 CEST
If MinGW wasn't already using AsmExternal implementation, it should be now.

https://github.com/D-Programming-GDC/GDC/pull/106