www.digitalmars.com         C & C++   DMDScript  

D - bug?

reply Evan McClanahan <evan dontSPAMaltarinteractive.com> writes:
For some reason, when I was writing a static constructor for a module, 
and I made an error in the code somewhere (which error doesn't seem 
important, since it happened to me several times while debugging the 
constructor (don't ask), and each time the compiler threw an exception 
and crashed after spitting out some error messages.  This one went 
uncaught, since it threw up a message box on my system.   Not sure 
what's causing it, but there are some issues there...

WSAData wsadata;
static this()
{
     int err = WSAStartop(0x0101us, &wsadata);

     if (err)
     {
         throw(new Exception("Error with networking startup.");
     }
}

the above caused this output:

winsock.d(19): found 's' when expecting ','
winsock.d(19): expression expected, not ','
winsock.d(23): found ';' when expecting ')'
winsock.d(24): found '}' when expecting ';'
winsock.d(27): basic type expected, not TOK80
winsock.d(27): no identifier for declarator

and then a crash with a segmentation violation, it looks like, but 
windows doesn't like to name it's shit in any worthwhile manner, so I 
can't really tell.  Says that an instruction tried to read memory at 
0x00000005, and everything died.  There's another problem too, since 
there's a typo in there. WSAStartop() isn't a function, but it seems to 
compile ok.  Am I doing the constructor incorrectly?  shouldn't total 
garbage in the d file cause some sort of error?

Additionally, I'm using implib to generate my winsock.lib file.  It 
seems to work fine, and gives me these messages:

C:\evan\src>implib winsock.lib c:\winnt\system32\winsock.dll
implib winsock.lib c:\winnt\system32\winsock.dll
Digital Mars Import Library Manager Version 7.6B1n
Copyright (C) Digital Mars 2000.  All Rights Reserved.
Input is a Windows WIN3 DLL file.
Output is a Windows WIN3 import library.
Digital Mars Import Library Creator complete.

And everything links fine and seems to be happy.  However, once I try to 
run the program, an error message pops up, saying that winsock.dll isn't 
a valid image, and that I should check it against my installation 
diskette or something similar.  I don't know what's going on there, but 
I don't have the patience to convert the winsock 2 stuff at the moment 
and see if that works. (for the record, ws2_32.lib, which the windows 
documentation says is what you're supposed to link with when using 
winsock2.dll (no idea why the names are different) isn't recognised by 
dmd .50 as a valid library file.)


Evan
Dec 07 2002
parent "Walter" <walter digitalmars.com> writes:
Hi Evan. I need a complete source file in order to track down any crashes
while compiling. Thanks, -Walter

"Evan McClanahan" <evan dontSPAMaltarinteractive.com> wrote in message
news:asth8i$2c66$1 digitaldaemon.com...
 For some reason, when I was writing a static constructor for a module,
 and I made an error in the code somewhere (which error doesn't seem
 important, since it happened to me several times while debugging the
 constructor (don't ask), and each time the compiler threw an exception
 and crashed after spitting out some error messages.  This one went
 uncaught, since it threw up a message box on my system.   Not sure
 what's causing it, but there are some issues there...

 WSAData wsadata;
 static this()
 {
      int err = WSAStartop(0x0101us, &wsadata);

      if (err)
      {
          throw(new Exception("Error with networking startup.");
      }
 }

 the above caused this output:

 winsock.d(19): found 's' when expecting ','
 winsock.d(19): expression expected, not ','
 winsock.d(23): found ';' when expecting ')'
 winsock.d(24): found '}' when expecting ';'
 winsock.d(27): basic type expected, not TOK80
 winsock.d(27): no identifier for declarator

 and then a crash with a segmentation violation, it looks like, but
 windows doesn't like to name it's shit in any worthwhile manner, so I
 can't really tell.  Says that an instruction tried to read memory at
 0x00000005, and everything died.  There's another problem too, since
 there's a typo in there. WSAStartop() isn't a function, but it seems to
 compile ok.  Am I doing the constructor incorrectly?  shouldn't total
 garbage in the d file cause some sort of error?

 Additionally, I'm using implib to generate my winsock.lib file.  It
 seems to work fine, and gives me these messages:

 C:\evan\src>implib winsock.lib c:\winnt\system32\winsock.dll
 implib winsock.lib c:\winnt\system32\winsock.dll
 Digital Mars Import Library Manager Version 7.6B1n
 Copyright (C) Digital Mars 2000.  All Rights Reserved.
 Input is a Windows WIN3 DLL file.
 Output is a Windows WIN3 import library.
 Digital Mars Import Library Creator complete.

 And everything links fine and seems to be happy.  However, once I try to
 run the program, an error message pops up, saying that winsock.dll isn't
 a valid image, and that I should check it against my installation
 diskette or something similar.  I don't know what's going on there, but
 I don't have the patience to convert the winsock 2 stuff at the moment
 and see if that works. (for the record, ws2_32.lib, which the windows
 documentation says is what you're supposed to link with when using
 winsock2.dll (no idea why the names are different) isn't recognised by
 dmd .50 as a valid library file.)


 Evan
Dec 08 2002