Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: From: "Lincoln, W. Terry" To: "'Bart Anderson'" Cc: "'cygwin AT sourceware DOT cygnus DOT com'" Subject: RE: Help with _beginthread Date: Mon, 17 May 1999 09:54:18 -0400 X-MS-TNEF-Correlator: MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01BEA06C.C25DA342" ------_=_NextPart_000_01BEA06C.C25DA342 Content-Type: text/plain; charset="iso-8859-1" > -----Original Message----- > From: Bart Anderson [mailto:bartanderson AT netscape DOT net] > Sent: Saturday, May 15, 1999 9:10 AM > To: cygwin > Subject: Help with _beginthread > > > ---------------------------------------------------- > Dear list > > My main objective was to rip out MFC code from the infocom > interpreter. > > I have struggled with this for a while now, and am in need of > technical > help/suggestions. > > My setup is egcs 1.1.2 with egcs-1_1_2-msvcrt40-runtime.zip installed > I also have V 1.21 installed and working. > > I have a test project that calls _beginthread() and this > compiles and works. > I have a more complex project with the same call to > _beginthread(), but it > can't find init_thread(). > > Any ideas. I'll only send the stuff people are willing to > look at, I don't want to burden the list ... ;) > > ------------------------------------------ > in real project > > WFrotzcmdw.cpp: _beginthread(init_thread(),4096,NULL); > > ..\c\Win_init.c:void init_thread() > > results from make > g++ -c -I../include -o WFrotzapp.o WFrotzapp.cpp > g++ -c -I../include -o WFrotzdlg.o WFrotzdlg.cpp > g++ -c -I../include -o WFrotzmdlg.o WFrotzmdlg.cpp > g++ -c -I../include -o WFrotzcnv.o WFrotzcnv.cpp > g++ -c -I../include -o WFrotzcmdw.o WFrotzcmdw.cpp > WFrotzcmdw.cpp: In function `BOOL startThread()': > WFrotzcmdw.cpp:39: warning: implicit declaration of function `int init_thread(...)' > WFrotzcmdw.cpp:39: warning: passing `int' to argument 1 of `_beginthread(void(*)(void *), unsigned int, void *)' lacks a cast The germane point in this message is the call to _beginthread expects a pointer to a function that returns void and accepts a single argument which is a `pointer to void'. You are not passing a pointer to a function in your call you are passing the result of a function call (which is returning an `int') as the argument. C++ is then trying to cast your int into a pointer to a function which is wrong. You should declare your function: void init_thread( void*); and call the function like so: _beginthread( init_thread, 4096, NULL); That should remove the error messages. > g++ -c -I../include -o Thread.o Thread.cpp > g++ -o WFrotz.exe ./WFrotzapp.o ./WFrotzdlg.o ./WFrotzmdlg.o > ./WFrotzcnv > .o > ./WF > rotzcmdw.o ./Thread.o ../frotz/Alias.o ../frotz/Buffer.o > ../frotz/Fastme > m.o > ../ > frotz/Files.o ../frotz/Getopt.o ../frotz/Hotkey.o ../frotz/Input.o > ../frotz/Math > .o ../frotz/Object.o ../frotz/Other.o ../frotz/Process.o > ../frotz/Rando > m.o > ../fr > otz/Redirect.o ../frotz/Screen.o ../frotz/Sound.o ../frotz/Stream.o > ../frotz/Tab > le.o ../frotz/Text.o ../frotz/Variable.o ../frotz/Main.o > ../c/Win_init.o > > ../c/W > in_input.o ../c/Win_pic.o ../c/Win_scrn.o ../c/Win_smpl.o > ../c/Win_text.o > -lV > -W > l --subsystem,windows -lgdi32 -luser32 -lwinmm -lcomdlg32 -lcomctl32 > ./WFrotzcmdw.o(.text+0x18):WFrotzcmdw.cc: undefined reference > to `init_ > thread' > C:\EGCS-1~1.2\BIN\MAKE.EXE: *** [WFrotz.exe] Error 1 > > ---------------------------------------------------------- > in test project > cfunc.c:void init_thread() > main.cpp: _beginthread(init_thread(),4096,NULL); > > results of make > C:\WinFrotz\Vproj\test>make > g++ -c main.cpp > main.cpp: In function `int main()': > main.cpp:18: warning: implicit declaration of function `int > init_thread(. > ..)' > main.cpp:18: warning: passing `int' to argument 1 of > `_beginthread(void > (*)(void > *), unsigned int, void *)' lacks a cast > gcc -c cfunc.c > g++ -o main.exe ./main.o ./cfunc.o -lv -Wl > --subsystem,windows -lcomctl > 32 > -lus > er32 -lgdi32 -lwinmm -lcomdlg32 > gcc -c cmain.c > gcc -o cmain cmain.o cfunc.o > > ____________________________________________________________________ > Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com. W. Terry Lincoln \ \ _ / Senior Engineer \ \ |J| / Ultimate Technology Corporation \ _|E|_ a Tridex Company (NASDAQ:trdx) \ |_ S _| mailto:WTerryLincoln AT engineer DOT com \ |U| http://www.AngelFire.com/ny/TerryLincoln \ / |S| \ http://www.geocities.com/Eureka/concourse/7326 \ | | ================================================ ~~~~~ Opinions expressed do not represent the management of UTC. ------_=_NextPart_000_01BEA06C.C25DA342 Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com ------_=_NextPart_000_01BEA06C.C25DA342--