I like POSIX,but my windows operating system is not support.
For example,there is no fork() function in win32.
So I try to build my programe by MinGW and libwg32c.
But in China,there is not many information on libwg32c.And I could not use the libwg32c successfully every time.
My Code is below.
/ main.c /
include <sys/types.h>
include <sys/socket.h>
include <netinet/in.h>
include <stdio.h>
int main(int argc ,char **argv)
{
int sockfd;
sockfd = socket(AF_INET,SOCK_DGRAM,0);
I cannot see much difference between the description of socket in the Single Unix Specification (http://www.opengroup.org/onlinepubs/009695399/functions/socket.html) and the one on MSDN (http://msdn.microsoft.com/library/en-us/winsock/winsock/socket_2.asp).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But using the programe that build by Cygwin will change operating system's data.
For example,it will write some data in Windows registry access.That is what I don't like.
I know that Cygwin could do that.But I wouldn't use it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2005-08-21
> But using the programe that build by Cygwin
> will change operating system's data
Huh?
> I know that Cygwin could do that.But I wouldn't use it.
Well, either you use Cygwin and have access to a mostly Unix-like (or Linux-like) API, including BSD sockets, and the traditional Unix headers. Or you use mingw and use the WinSock API. You can't both have your cake and eat it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,everyone
I am a Chinese student in Shanghai.
I have some problem on using libwg32c.
I like POSIX,but my windows operating system is not support.
For example,there is no fork() function in win32.
So I try to build my programe by MinGW and libwg32c.
But in China,there is not many information on libwg32c.And I could not use the libwg32c successfully every time.
My Code is below.
/ main.c /
include <sys/types.h>
include <sys/socket.h>
include <netinet/in.h>
include <stdio.h>
int main(int argc ,char **argv)
{
int sockfd;
sockfd = socket(AF_INET,SOCK_DGRAM,0);
}
/ main.c end/
My Makefile is below
Makefile.txt
all:
gcc -c "main.c" -o "main.o" -D__GW32C__ -I"D:/Program Files/GnuWin32/include/glibc" -I"D:/Program Files/GnuWin32/include/winx"
gcc "main.o" -o "main.exe" -L"D:/Program Files/GnuWin32/lib -l"gw32c" -l"wsock32" -l"ole32" -l"uuid"
Makefile.txt end
But the error is appear.
gcc -c "main.c" -o "main.o" -D__GW32C__ -I"D:/Program Files/GnuWin32/include/gli
bc" -I"D:/Program Files/GnuWin32/include/winx"
gcc "main.o" -o "main.exe" -L"D:/Program Files/GnuWin32/lib -l"gw32c" -l"wsock32
" -l"ole32" -l"uuid"
main.o(.text+0x42):main.c: undefined reference to `socket'
collect2: ld returned 1 exit status
mingw32-make: *** [all] Error 1
I don't know what's worroy with the lib or my source?
My tools are show below.
MinGW32:
binutils-2.15.91-20040904-1.tar.gz
gcc-core-3.4.2-20040916-1.tar.gz
mingw-runtime-3.7.tar.gz
w32api-3.2.tar.gz
mingw32-make-3.80.0-3.tar.gz
LibGW32C:
libgw32c-0.4.exe
Operating System:
Windows XP Home Edition
Wait for your help.
Please HELP me.
Huangxiangkui
socket is an ordinary Win32 API function from Winsock; see http://msdn.microsoft.com/library/en-us/winsock/winsock/socket_2.asp. You must include windows.h or winsock.h and link to one of the winsock libraries libwsock32.a or libws2_32.a. which are provided with Mingw.
But the win32's socket is not the same as GLibC
I want to use GLibC's socket.
I hope my code will look like a using GLibC's code.
Oh. If you want glibc, you need Linux. Or maybe Cygwin, it is close in some aspects. Anyway, mingw is not what you want.
I cannot see much difference between the description of socket in the Single Unix Specification (http://www.opengroup.org/onlinepubs/009695399/functions/socket.html) and the one on MSDN (http://msdn.microsoft.com/library/en-us/winsock/winsock/socket_2.asp).
But using the programe that build by Cygwin will change operating system's data.
For example,it will write some data in Windows registry access.That is what I don't like.
I know that Cygwin could do that.But I wouldn't use it.
> But using the programe that build by Cygwin
> will change operating system's data
Huh?
> I know that Cygwin could do that.But I wouldn't use it.
Well, either you use Cygwin and have access to a mostly Unix-like (or Linux-like) API, including BSD sockets, and the traditional Unix headers. Or you use mingw and use the WinSock API. You can't both have your cake and eat it.
I don't want use WinSock API or any other Win32 API
I am only want to use the API whose interface is like GlibC.
Cygwin want to setup in win32.whatever,run the program or develop the program.That is what I don't like.
Did you use Cygwin in windows?
if used.please run regedit.exe.
You will find there are some keys of Cygwin in your regedit.
If you are a user of the program which is develop on Cygwin.you run the program,and there wiil be some key which is not nessery in the user's regedit.
That why I use MinGW ,not Cygwin.
Well, you can't get there from here.
........
Oh,my god.
I think the libgw32c will be better than now.
I am waitting for that.