[Bug 169] New: Compilation of module fails with -unittest
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue May 30 19:44:11 PDT 2006
    
    
  
http://d.puremagic.com/bugzilla/show_bug.cgi?id=169
           Summary: Compilation of module fails with -unittest
           Product: D
           Version: 0.159
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: CppCoder at gmail.com
module eventpool;
import std.c.windows.windows;
extern (Windows)
{
        HANDLE CreateEvent(
                LPSECURITY_ATTRIBUTES lpEventAttributes,
                BOOL bManualReset,
                BOOL bInitialState,
                LPCTSTR lpName
        );
        BOOL SetEvent(
                HANDLE hEvent
        );
        BOOL ResetEvent(
                HANDLE hEvent
        );
}
class Event
{
        public HANDLE event;
        public this( bool manualReset, bool initialState )
        {
                event = CreateEvent( null, manualReset, initialState, null );
        }
        public this()
        {
                this( true, false );
        }
        public ~this()
        {
                CloseHandle( event );
        }
        bool signalled()
        {
                ulong waitRes;
                waitRes = WaitForSingleObject( event, 0 );
                return (waitRes == WAIT_OBJECT_0);
        }
        void signalled( bool isSignalled )
        {
                if ( isSignalled )
                {
                        SetEvent( event );
                }
                else
                {
                        ResetEvent( event );
                }
        }
        unittest
        {
                Event ev = new Event();
                ev.signalled = true;
                assert( ev.signalled == true );
                ev.signalled = false;
                assert( ev.signalled == false );
                delete ev;
        }
}
when compiling with "-unittest":
eventpool.obj(eventpool)
 Error 42: Symbol Undefined _CreateEvent at 16
--- errorlevel 1
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list