From: <joe...@ya...> - 2002-09-20 09:02:03
|
Hi, the attached code saved as 'simple.c' and compiled with gcc 2.95.3-6 and mingw-runtime 2.0 as $ gcc simple.c -lwsock32 -mwindows -o simple.exe doesn't run on WindowsNT SP6a. This is due to the fact that the procedure entry point for symbol 'WSAFDIsSet' can't be found. Strange, since gethostbyname doesn't cause any problems. If you comment the FD_ISSET line, the executable runs. Can someone reproduce this problem with symbol '__WSAFDIsSet'? If yes, can some recommend a way to solve this problem? Thanks in advance, Jörg ---------------------------------------------------------------- #include <winsock2.h> #include <windows.h> const char g_szClassName[] = "myWindowClass"; LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int osfd = 0, ex; if (gethostbyname("asff")==0) {} if (FD_ISSET((SOCKET)osfd, &ex)) { } switch(msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; HWND hwnd; MSG Msg; wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = NULL; wc.lpszClassName = g_szClassName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); RegisterClassEx(&wc); hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, g_szClassName, "The title of my window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam; } __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de |
From: <dan...@ya...> - 2002-09-20 09:21:16
|
--- Joerg Brunsmann <joe...@ya...> wrote: > Hi, > > the attached code saved as 'simple.c' and compiled with > gcc 2.95.3-6 and mingw-runtime 2.0 as > > $ gcc simple.c -lwsock32 -mwindows -o simple.exe ^^^^^^^^^^ > $ gcc simple.c -lws2_32 -mwindows -o simple.exe should work. Use ws2_32.dll with winsock2.h interface ===snip=== > > ---------------------------------------------------------------- > #include <winsock2.h> > #include <windows.h> Danny http://mobile.yahoo.com.au - Yahoo! Messenger for SMS - Always be connected to your Messenger Friends |
From: <joe...@ya...> - 2002-09-20 09:47:30
|
--- Danny Smith <dan...@ya...> schrieb: > $ gcc simple.c -lws2_32 -mwindows -o simple.exe > > should work. > > Use ws2_32.dll with winsock2.h interface Thanks for your answer. I tried, but unfortunately it didn't work as expected. Any other hint? Thanks. Jörg __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de |
From: Earnie B. <ear...@ya...> - 2002-09-20 10:55:01
|
Joerg Brunsmann wrote: > > --- Danny Smith <dan...@ya...> schrieb: > > > $ gcc simple.c -lws2_32 -mwindows -o simple.exe > > > > should work. > > > > Use ws2_32.dll with winsock2.h interface > > Thanks for your answer. I tried, but unfortunately it didn't > work as expected. Any other hint? Thanks. > BoydE@DU216771 /adhoc/junk $ gcc -o simple simple.c -lws2_32 -mwindows BoydE@DU216771 /adhoc/junk $ gcc -o simple simple.c -lwsock32 -mwindows BoydE@DU216771 /adhoc/junk $ cat /mingw/include/w32api.h | grep define | grep VERSION #define __W32API_VERSION 2.0 #define __W32API_MAJOR_VERSION 2 #define __W32API_MINOR_VERSION 0 #endif /* ndef _W32API_H_ */ BoydE@DU216771 /adhoc/junk $ cat /mingw/include/_mingw.h | grep define | grep VERSION #define __MINGW32_VERSION 2.1 #define __MINGW32_MAJOR_VERSION 2 #define __MINGW32_MINOR_VERSION 2 Earnie. P.S.: Yes, I see that __MINGW32_VERSION isn't correct. |
From: <joe...@ya...> - 2002-09-20 12:27:21
|
--- Earnie Boyd <ear...@ya...> schrieb: > BoydE@DU216771 /adhoc/junk > $ gcc -o simple simple.c -lws2_32 -mwindows > BoydE@DU216771 /adhoc/junk > $ gcc -o simple simple.c -lwsock32 -mwindows What happens if you start the application? > P.S.: Yes, I see that __MINGW32_VERSION isn't correct. Are you indicating that changing to a correct version number should fix the problem? Jörg __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de |
From: Earnie B. <ear...@ya...> - 2002-09-20 14:51:14
|
Joerg Brunsmann wrote: > = > --- Earnie Boyd <ear...@ya...> schrieb: > = > > BoydE@DU216771 /adhoc/junk > > $ gcc -o simple simple.c -lws2_32 -mwindows > > BoydE@DU216771 /adhoc/junk > > $ gcc -o simple simple.c -lwsock32 -mwindows > = > What happens if you start the application? > = It gets a sigsegv at CreateWindowEX according to gdb. Dependency Walker gives: DllMain(0x776B0000, DLL_PROCESS_ATTACH, 0x0022FF30) in "WS2_32.DLL" called. DllMain(0x776B0000, DLL_PROCESS_ATTACH, 0x0022FF30) in "WS2_32.DLL" returned 1 (0x1). Second chance exception 0xC0000005 (Access Violation) occurred in "WS2_32.DLL" at address 0x776BA10D. Exited "SIMPLE.EXE" (process 0x14E) with code 128 (0x80). > > P.S.: Yes, I see that __MINGW32_VERSION isn't correct. > = > Are you indicating that changing to a correct version number > should fix the problem? > = No, I meant that the __MINGW32_VERSION should be set to 2.2 not 2.1. > J=F6rg > = > __________________________________________________________________ > = > Gesendet von Yahoo! Mail - http://mail.yahoo.de > M=F6chten Sie mit einem Gru=DF antworten? http://grusskarten.yahoo.de > = > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > MinGW-users mailing list > Min...@li... > = > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users |
From: <joe...@ya...> - 2002-09-20 19:07:38
|
--- Earnie Boyd <ear...@ya...> schrieb: > It gets a sigsegv at CreateWindowEX according to gdb. If you compile it with bcc55 or watcom 11.0c you'll get a message box claiming that "procedure entry point for symbol "WSAFDIsSet" cannot be located". Notice the missing underscores. If you compile it with Visual C++ it runs. If you look at the watcom/bcc55 compiled executable with dependency walker "depends.exe" from Visual C++ you'll see an unresolved parent import for symbol "WSAFDIsSet". Ideas? Jörg __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de |
From: Earnie B. <ear...@ya...> - 2002-09-20 21:51:02
|
Your bug is in the declaration of ex. You're just lucky that it works with the VC++ build system. <code> LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int osfd =3D 0; fd_set *ex =3D (fd_set *)malloc(sizeof(fd_set)); </code> Earnie. Joerg Brunsmann wrote: > = > --- Earnie Boyd <ear...@ya...> schrieb: > = > > It gets a sigsegv at CreateWindowEX according to gdb. > = > If you compile it with bcc55 or watcom 11.0c you'll > get a message box claiming that "procedure entry point > for symbol "WSAFDIsSet" cannot be located". Notice the > missing underscores. If you compile it with Visual C++ > it runs. If you look at the watcom/bcc55 compiled > executable with dependency walker "depends.exe" from > Visual C++ you'll see an unresolved parent import > for symbol "WSAFDIsSet". Ideas? > = > J=F6rg > = > __________________________________________________________________ > = > Gesendet von Yahoo! Mail - http://mail.yahoo.de > M=F6chten Sie mit einem Gru=DF antworten? http://grusskarten.yahoo.de |
From: <joe...@ya...> - 2002-09-21 05:22:06
|
--- Earnie Boyd <ear...@ya...> schrieb: > Your bug is in the declaration of ex. You're just lucky that it works > with the VC++ build system. I'm afraid, no. Even if write something like <code> LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int x =0; fd_set *ex = (fd_set *)malloc(sizeof(fd_set)); if (msg == 0) msg++; if (!msg) FD_ISSET(x, ex); </code> to exclude "FD_ISSET" from the execution path I get the same "procedure entry point" error. It's not an execution problem it's somewhat a linkage problem. But, you're claiming that if you make your suggested modification the executable does work for you on Windows NT? Sorry, to bother you again. Jörg __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de |
From: Earnie B. <ear...@ya...> - 2002-09-21 10:20:10
Attachments:
simple.c
|
Joerg Brunsmann wrote: > > --- Earnie Boyd <ear...@ya...> schrieb: > > > Your bug is in the declaration of ex. You're just lucky that it works > > with the VC++ build system. > > I'm afraid, no. Even if write something like > > <code> > LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) > int x =0; > fd_set *ex = (fd_set *)malloc(sizeof(fd_set)); > if (msg == 0) msg++; > if (!msg) FD_ISSET(x, ex); > </code> > > to exclude "FD_ISSET" from the execution path I get the same > "procedure entry point" error. It's not an execution problem it's > somewhat a linkage problem. But, you're claiming that if you make > your suggested modification the executable does work for you on > Windows NT? Sorry, to bother you again. > It works for me on Windows NT4 sp6a. I don't know what you mean by 'exclude "FD_ISSET" from the execution path'. I don't know what you mean by "somewhat of a linkage problem". My version is attached. Earnie. |
From: Earnie B. <ear...@ya...> - 2002-09-21 10:40:59
|
Earnie Boyd wrote: > > My version is attached. > > Earnie. > > ------------------------------------------------------------------------ > Name: simple.c > simple.c Type: jGRASP C or C++ file (application/x-unknown-content-type-jGRASPCOrCppFile) > Encoding: base64 I just love the way windows programs work. It's not encoded. I need to fix netscrape mail. Earnie. |
From: <joe...@ya...> - 2002-09-21 13:36:33
|
--- Earnie Boyd <ear...@ya...> schrieb: > It works for me on Windows NT4 sp6a. You're right. I'm stupid. It works compiled with mingw. It still crashes compiled with bcc32. And it still does not even start compiled with watcom. I can send you the erroneous watcom executable in case your are interested. I tried to solve this problem with watcom people but they didn't respond. They still have to learn that open source implies open mind. It has to be an error either in the linker, in the include files or in the import libraries. But this is not your business. Mingw has obviously advantages when it comes to quality both of software and support. I'll switch to mingw. Anyway, sorry for stealing your time and thanks a lot for your much appreciated help kicking me in the right direction. Jörg __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de |