wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) (05/16/91)
Is following correct (OS/2 1.2EE / IBM C/2 1.1): The main thread of an application creates a second thread (with DosCreateThread) that uses printf to display some text. The .obj file is linked to llibcmt & doscalls. Looking at IBM's examples this is supposed to be correct, but the stack overflow (R6000) I get on execution does not agree with this. So, who's right? Any suggestion? -- Christophe Wolfhugel (on irc: Zolf) | Email: wolf@grasp1.univ-lyon1.fr INSA Lyon - Departement Informatique | "Ecole publique, ecole fauchee. Encore" 69621 Villeurbanne Cedex | "une tradition francaise dont on se" France | "passerait bien."
ballard@ucs.ubc.ca (Alan Ballard) (05/17/91)
In article <1991May16.153241.11420@grasp1.univ-lyon1.fr> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes: >Is following correct (OS/2 1.2EE / IBM C/2 1.1): > >The main thread of an application creates a second thread (with >DosCreateThread) that uses printf to display some text. The .obj >file is linked to llibcmt & doscalls. Hard to know without seeing the source. Are you sure you are setting up the stack for DosCreateThread correctly? Are you compiling with the right memory model for llibcmt? -- Alan Ballard | Internet: ballard@ucs.ubc.ca University Computing Services | Bitnet: USERAB1@UBCMTSG University of British Columbia | Phone: 604-822-3074 Vancouver B.C. Canada V6R 1Z2 | Fax: 604-822-5116
wbonner@yoda.eecs.wsu.edu (Wim Bonner) (05/17/91)
In article <1991May16.153241.11420@grasp1.univ-lyon1.fr> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes: >Is following correct (OS/2 1.2EE / IBM C/2 1.1): > >The main thread of an application creates a second thread (with >DosCreateThread) that uses printf to display some text. The .obj >file is linked to llibcmt & doscalls. Are you using MSC 6.0? If so, instead of using DosCreateThread, use the MS Call _beginthread which is designed so that it will allow the things in the C Runtime Library to work correctly. I had a similar problem and it took me some time to figure out, and mostly because of the backwards way the MSC Manuals are arranged. Wim. -- | wbonner@yoda.eecs.wsu.edu | The Loft BBS | 27313853@wsuvm1.csc.wsu.edu | (509)335-4339 | 72561.3135@CompuServe.com | USR HST Dual Standard HST/V.32
czahl@opal.cs.tu-berlin.de (Christian Zahl) (05/18/91)
(article lost?!) The problem is explained in the handbooks (Language Reference, Compile Link..). There are some funktions in the libraries, in which the stackcheck is fix included. One of these is the printf function. The full list is included in the manuals. One way out of this desaster is to patch this funktion by extracting from the library with LIB, patching with DEBUG, and replacing with LIB). The other possiblity is to use sprintf and VioWrtTTY instead. hope it helps.. ------------------------------------------------------------------------------- Christian Zahl - pure student ! Technische Universitaet Berlin, Germany
petergo@microsoft.UUCP (Peter GOLDE) (05/21/91)
>In article <1991May16.153241.11420@grasp1.univ-lyon1.fr> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes: >>Is following correct (OS/2 1.2EE / IBM C/2 1.1): >> >>The main thread of an application creates a second thread (with >>DosCreateThread) that uses printf to display some text. The .obj >>file is linked to llibcmt & doscalls. If the C/2 libraries are like the MS-C libraries (and I think they are very close), you need to call _beginthread to start the thread rather than DosCreateThread. _beginthread initializes some per-thread static data (stuff like errno), which also includes the stack size used by the stack checking routine. Calling DosCreateThread directly will result in problems like what you are seeing.