Not to reply to my own message or what not ;)...

I did fix it, kind of.  It is really weird.  Using pthreads, I was still dependent on 
cygwin1.dll.  I went ahead and installed the pthreads-win32 version for mingw and 
then compiled the program again using cygwin (and the mno-cygwin) plus pointing it 
to the mingw lib/includes.  This threw up some error about redefining stuff:

In file included from ../../include/pcap-stdinc.h:49,
                 from ../../include/pcap.h:41,
                 from sniffsniffer.c:1:
../../include/bittypes.h:36: error: redefinition of `int8_t'
/cygdrive/c/mingw/include/stdint.h:27: error: `int8_t' previously declared here
../../include/bittypes.h:52: error: redefinition of `int16_t'
/cygdrive/c/mingw/include/stdint.h:29: error: `int16_t' previously declared here

../../include/bittypes.h:71: error: redefinition of `int32_t'
/cygdrive/c/mingw/include/stdint.h:31: error: `int32_t' previously declared here

So I hacked the pcap-stdinc.h file and removed the include to bittypes...

Now it compiles competely (no errors or warnings) and runs perfectly... Now that 
cygwin1.dll is out of there...

Any idea why this happened? Or am I making this too complicated.. or what!  I hate 
to hack up that include file, especially when I don't know why.

Thanks,

Eric

On 11 Jun 2004 at 8:06, [EMAIL PROTECTED] wrote:

> I knew I should have mentioned this in the first message. But, yes I 
> know.  The problem is, it never even gets to that section.  That 
> message is never displayed on the screen so it seems the thread is 
> never called.  
> 
> I just compiled and ran it in insight (gdb gui) and something 
> interesting is showing.  The pthread_create causes a seg fault and 
> the debugger cuts to assembly of cygwin1... Can someone try that 
> code below, and tell me if it runs?... maybe it is my cygwin that is 
> screwy (shouldn't be, I just d/l it two days ago, clean install)
> 
> --Eric
> 
> 
> On 11 Jun 2004 at 8:16, Ainsley wrote:
> 
> > On Thu, Jun 10, 2004 at 04:44:20PM -0700, [EMAIL PROTECTED] wrote:
> > > I am really having some troubles with running pthreads and winpcap together.  
> > > I am pretty rusty on my C so maybe it is just my stupidity, but I keep getting
> > > lockups and my program will not run.
> > > 
> > > Basically, what I am trying to do is start a thread that will send out some
> > > packets once every few seconds.  While this thread is going the main program
> > > calls the pcap_loop and is listening for certain replies.
> > > 
> > > Unfortunately, when I put the pthread_create call in the program and run it, 
> > > it just locks up on that call(ran it in gdb).  I comment out that line and 
> > > the listening part runs just fine.
> > > 
> > [snip]
> > > =============== test.c =================
> > > 
> > > #include <pcap.h>
> > > #include <remote-ext.h> 
> > > #include <pthread.h>
> > > 
> > > void *test(void *blah)
> > > {
> > >   int done=0;    
> > >   while(!done){
> > >      printf("Who: %s\n", (char *)blah);
> > >      sleep(5);
> > >   }
> > > }
> > > 
> > > int main(){
> > >     pcap_if_t *alldevs;
> > >     pcap_if_t *d;
> > >     int inum;
> > >     int i=0;
> > >     pcap_t *adhandle;
> > >     char errbuf[PCAP_ERRBUF_SIZE];
> > > 
> > >     pthread_t t1;
> > >     pthread_create(&t1, NULL,&test,(void *)"numero uno");
> > >     pthread_join(t1,NULL);
> > 
> > To join a thread means to wait for it to complete. Since nothing sets
> > done in test(), your thread won't complete, so this thread will sit
> > waiting here indefinitely. This has nothing to do with winpcap.
> > 
> > Hope that helps,
> > Ainsley.
> > 
> > 
> > ==================================================================
> >  This is the WinPcap users list. It is archived at
> >  http://www.mail-archive.com/[EMAIL PROTECTED]/
> > 
> >  To unsubscribe use 
> >  mailto: [EMAIL PROTECTED]
> > ==================================================================
> > 
> 
> 
> 
> 
> ==================================================================
>  This is the WinPcap users list. It is archived at
>  http://www.mail-archive.com/[EMAIL PROTECTED]/
> 
>  To unsubscribe use 
>  mailto: [EMAIL PROTECTED]
> ==================================================================
> 




==================================================================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/[EMAIL PROTECTED]/

 To unsubscribe use 
 mailto: [EMAIL PROTECTED]
==================================================================

Reply via email to