digitalmars.D.bugs - [Bug 169] New: Compilation of module fails with -unittest
- d-bugmail puremagic.com (76/76) May 30 2006 http://d.puremagic.com/bugzilla/show_bug.cgi?id=169
- Don Clugston (9/103) May 30 2006 There's no CreateEvent() function in Windows.
- akcom (2/110) May 31 2006 If I didn't feel stupid before...
- d-bugmail puremagic.com (7/7) May 31 2006 http://d.puremagic.com/bugzilla/show_bug.cgi?id=169
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 digitalmars.com ReportedBy: CppCoder 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 16 --- errorlevel 1 --
May 30 2006
There's no CreateEvent() function in Windows. It's CreateEventW() or CreateEventA(), which then get aliased: extern (Windows) { HANDLE CreateEventW( ... } alias CreateEventW CreateEvent; d-bugmail puremagic.com wrote: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 digitalmars.com ReportedBy: CppCoder 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 16 --- errorlevel 1
May 30 2006
Don Clugston wrote:There's no CreateEvent() function in Windows. It's CreateEventW() or CreateEventA(), which then get aliased: extern (Windows) { HANDLE CreateEventW( ... } alias CreateEventW CreateEvent; d-bugmail puremagic.com wrote:If I didn't feel stupid before...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 digitalmars.com ReportedBy: CppCoder 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 16 --- errorlevel 1
May 31 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=169 CppCoder gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --
May 31 2006