|
|
@ -2,14 +2,29 @@ |
|
|
|
(export |
|
|
|
(comptime-cond |
|
|
|
('Windows |
|
|
|
(c-import "<string.h>" |
|
|
|
"<winsock2.h>" "<stdio.h>")) |
|
|
|
(c-import "<string.h>" "<winsock2.h>" "<stdio.h>")) |
|
|
|
(true |
|
|
|
(c-import "<string.h>" |
|
|
|
"<sys/socket.h>" "<sys/types.h>" "<unistd.h>" |
|
|
|
"<netinet/tcp.h>" "<netinet/in.h>" "<netdb.h>"))) |
|
|
|
(def-type-alias-global socket-type int)) |
|
|
|
|
|
|
|
;; For WORD, MAKEWORD |
|
|
|
(c-import "<windows.h>") |
|
|
|
|
|
|
|
(defun network-initialize (&return int) |
|
|
|
(comptime-cond |
|
|
|
('Windows |
|
|
|
(var requested-version WORD (MAKEWORD 2 2)) |
|
|
|
(var sockets-data WSADATA) |
|
|
|
(return (WSAStartup requested-version (addr sockets-data))))) |
|
|
|
(return 0)) |
|
|
|
|
|
|
|
(defun network-shutdown () |
|
|
|
(comptime-cond |
|
|
|
('Windows |
|
|
|
(WSACleanup)))) |
|
|
|
|
|
|
|
(comptime-cond |
|
|
|
('Windows |
|
|
|
(import "CHelpers.cake") |
|
|
|