* CRT runtime error with .Net 2003
@ 2004-03-11 23:30 Brian Bazyk
2004-03-11 23:57 ` Mark Weaver
2004-03-12 11:17 ` vc
0 siblings, 2 replies; 3+ messages in thread
From: Brian Bazyk @ 2004-03-11 23:30 UTC (permalink / raw)
To: pthreads-win32
Hi, I'm very new here but you seem like a helpful bunch of people. I have
the glorious job of porting a Linux application that uses pthreads to
Win32 .Net 2003.
The app used pthreads so I'm linking statically with the pthreadsVC
library. I'm compiling with MTd runtime's and using
IgnoreLib:libcmtd;libmmt to deal with some redefined function issues.
I'm recieving a runtime write segfault on the line:
fprintf(stderr,"Program usage: %s <prediction file>.pred | <PDB
file>.pdb\n",argv[0]);
Debugging at the segfault gives me (_file.c):
void __cdecl _lock_file (
void *pf
)
{
/*
* The way the FILE (pointed to by pf) is locked depends on whether
* it is part of _iob[] or not
*/
if ( (pf >= (void *)_iob) && (pf <= (void *)(&_iob[_IOB_ENTRIES-
1])) )
/*
* FILE lies in _iob[] so the lock lies in _locktable[].
*/
_lock( _STREAM_LOCKS + (int)((FILE *)pf - _iob) );
else
/*
* Not part of _iob[]. Therefore, *pf is a _FILEX and the
* lock field of the struct is an initialized critical
* section.
*/
!!ThisLine!! EnterCriticalSection( &(((_FILEX *)pf)->lock) );
}
Any idea what's wrong with my CRT? Are there any particular linker
options or something else I may not be aware of? Could this even be
related to pthreads or is it something else wrong with the project.
Any ideas would be appreciated.
Thanks in advance,
~Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: CRT runtime error with .Net 2003
2004-03-11 23:30 CRT runtime error with .Net 2003 Brian Bazyk
@ 2004-03-11 23:57 ` Mark Weaver
2004-03-12 11:17 ` vc
1 sibling, 0 replies; 3+ messages in thread
From: Mark Weaver @ 2004-03-11 23:57 UTC (permalink / raw)
To: Brian Bazyk, pthreads-win32
> The app used pthreads so I'm linking statically with the pthreadsVC
> library. I'm compiling with MTd runtime's and using
> IgnoreLib:libcmtd;libmmt to deal with some redefined function issues.
>
It sounds like you are mixing different versions of the static runtime
libraries. Your best bet is probably to recompile the pthreads lib with
.NET 2003 selecting the appropriate runtime library (i.e. the same one that
you want ot use). You should then see the redefined symbols, and the
problem, go away.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: CRT runtime error with .Net 2003
2004-03-11 23:30 CRT runtime error with .Net 2003 Brian Bazyk
2004-03-11 23:57 ` Mark Weaver
@ 2004-03-12 11:17 ` vc
1 sibling, 0 replies; 3+ messages in thread
From: vc @ 2004-03-12 11:17 UTC (permalink / raw)
To: pthreads-win32, Brian Bazyk
Hi Brian,
I have never tried to use pthread as a static lib, so I can't help you here.
But if you use the pthread as a dll, and if you use the /MT flag,
one of it's tests will fail, so for a dll you have to use the /MD flag.
Nevertheless, you should use for your app the same flag /MT or /MD
for _all_ the modules involved, otherwise you can get into trouble.
Viv
----- Original Message -----
From: "Brian Bazyk" <bnbazyk@ucdavis.edu>
To: <pthreads-win32@sources.redhat.com>
Sent: Friday, March 12, 2004 12:30 AM
Subject: CRT runtime error with .Net 2003
>
> Hi, I'm very new here but you seem like a helpful bunch of people. I have
> the glorious job of porting a Linux application that uses pthreads to
> Win32 .Net 2003.
>
> The app used pthreads so I'm linking statically with the pthreadsVC
> library. I'm compiling with MTd runtime's and using
> IgnoreLib:libcmtd;libmmt to deal with some redefined function issues.
>
> I'm recieving a runtime write segfault on the line:
> fprintf(stderr,"Program usage: %s <prediction file>.pred | <PDB
> file>.pdb\n",argv[0]);
>
> Debugging at the segfault gives me (_file.c):
>
> void __cdecl _lock_file (
> void *pf
> )
> {
> /*
> * The way the FILE (pointed to by pf) is locked depends on
whether
> * it is part of _iob[] or not
> */
> if ( (pf >= (void *)_iob) && (pf <= (void *)(&_iob[_IOB_ENTRIES-
> 1])) )
> /*
> * FILE lies in _iob[] so the lock lies in _locktable[].
> */
> _lock( _STREAM_LOCKS + (int)((FILE *)pf - _iob) );
> else
> /*
> * Not part of _iob[]. Therefore, *pf is a _FILEX and the
> * lock field of the struct is an initialized critical
> * section.
> */
> !!ThisLine!! EnterCriticalSection( &(((_FILEX *)pf)->lock) );
> }
>
> Any idea what's wrong with my CRT? Are there any particular linker
> options or something else I may not be aware of? Could this even be
> related to pthreads or is it something else wrong with the project.
> Any ideas would be appreciated.
>
> Thanks in advance,
> ~Brian
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-03-12 11:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-11 23:30 CRT runtime error with .Net 2003 Brian Bazyk
2004-03-11 23:57 ` Mark Weaver
2004-03-12 11:17 ` vc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).