Windows target : Moving from VC 6.0 to MinGW32 / MinGW64. 32 bits and 64 bits release supported.

git-svn-id: svn://svn.code.sf.net/p/hxcfloppyemu/code/HxCFloppyEmulator/libhxcadaptor/trunk@1953 63fa2f70-6a9b-4bc4-b855-9c6a949b1d69
This commit is contained in:
Jean-François DEL NERO committed 2020-02-14 08:12:44 +00:00
1 parent cc0310793b
commit ed3e9e279e
2 files changed
+85 -74

No files matched your search

+17 -6
View File
@@ -2,7 +2,7 @@
CC=gcc
AR=ar
UNAME := $(shell uname)
TARGET := $(shell uname)
BASEDIR=../sources
INCLUDES = -I$(BASEDIR)/ -I ../../../libhxcfe/trunk/sources -I ../../../libusbhxcfe/trunk/sources
@@ -11,19 +11,30 @@ DEBUG ?= 0
ifeq ($(DEBUG), 1)
CFLAGS=-O0 $(INCLUDES) -Wall -g -DDEBUG -fsanitize=address -fno-omit-frame-pointer
LDFLAGS= -shared -lc -lm -ldl -lasan
LDFLAGS= -shared
else
CFLAGS=-O3 $(INCLUDES) -Wall
LDFLAGS= -shared -lc -lm -ldl -s
LDFLAGS= -shared -s
endif
ifeq ($(UNAME), Linux)
ifeq ($(TARGET), Linux)
CFLAGS += -fPIC -Wl,-Map,foo.map
LDFLAGS += -lc -lm -ldl
endif
ifeq ($(UNAME), Darwin)
ifeq ($(TARGET), mingw32)
CC=i686-w64-mingw32-gcc
LDFLAGS += -lc -lm -ldl
endif
ifeq ($(TARGET), mingw64)
CC=x86_64-w64-mingw32-gcc
LDFLAGS += -lc -lm -ldl
endif
ifeq ($(TARGET), Darwin)
CFLAGS += -arch x86_64 -mmacosx-version-min=10.9
LDFLAGS += -arch x86_64 -mmacosx-version-min=10.9
LDFLAGS += -lc -lm -ldl -arch x86_64 -mmacosx-version-min=10.9
endif
EXEC=libhxcadaptor.a
+68 -68
View File
@@ -42,26 +42,26 @@
//
// Change History (most recent first):
///////////////////////////////////////////////////////////////////////////////////
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <stdint.h>
#ifdef WIN32
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <windows.h>
#include <commctrl.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <stdint.h>
#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <commctrl.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
@@ -76,16 +76,16 @@ typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr SOCKADDR;
#include <unistd.h>
#include <dirent.h>
#ifdef OSX
# include <mach-o/dyld.h>
#endif
#endif
#include "network.h"
#include "libhxcfe.h"
#include "libhxcadaptor.h"
#ifdef OSX
# include <mach-o/dyld.h>
#endif
#endif
#include "network.h"
#include "libhxcfe.h"
#include "libhxcadaptor.h"
void * network_connect(char * address,unsigned short port)
{
@@ -117,10 +117,10 @@ void * network_connect(char * address,unsigned short port)
free(tcp_stat);
return (void*)NULL;
}
tcp_stat->clientService.sin_family = AF_INET;
tcp_stat->clientService.sin_addr.s_addr = inet_addr(address);
tcp_stat->clientService.sin_port = htons(port);
tcp_stat->clientService.sin_family = AF_INET;
tcp_stat->clientService.sin_addr.s_addr = inet_addr(address);
tcp_stat->clientService.sin_port = htons(port);
if (connect(tcp_stat->m_socket, (SOCKADDR*)&tcp_stat->clientService, sizeof(tcp_stat->clientService)) == SOCKET_ERROR)
{
@@ -162,45 +162,45 @@ int network_read(void * network_connection, unsigned char * buffer, int size,int
return size;
}
int network_read2(void * network_connection, unsigned char * buffer, int size,int timeout)
{
int bytesRecv;
int offset;
hxc_tcp_stat * tcp_stat;
tcp_stat = (hxc_tcp_stat *)network_connection;
offset=0;
bytesRecv = recv(tcp_stat->m_socket, (char*)&buffer[offset], size - offset, 0);
return bytesRecv;
}
int network_write(void * network_connection, unsigned char * buffer, int size,int timeout)
{
int bytesSent;
int offset;
hxc_tcp_stat * tcp_stat;
int network_read2(void * network_connection, unsigned char * buffer, int size,int timeout)
{
int bytesRecv;
int offset;
hxc_tcp_stat * tcp_stat;
tcp_stat = (hxc_tcp_stat *)network_connection;
offset = 0;
while(offset < size)
{
bytesSent = send(tcp_stat->m_socket, (char*)&buffer[offset], size - offset, 0);
if(bytesSent == SOCKET_ERROR)
{
return -1;
}
else
{
offset += bytesSent;
}
offset=0;
bytesRecv = recv(tcp_stat->m_socket, (char*)&buffer[offset], size - offset, 0);
return bytesRecv;
}
int network_write(void * network_connection, unsigned char * buffer, int size,int timeout)
{
int bytesSent;
int offset;
hxc_tcp_stat * tcp_stat;
tcp_stat = (hxc_tcp_stat *)network_connection;
offset = 0;
while(offset < size)
{
bytesSent = send(tcp_stat->m_socket, (char*)&buffer[offset], size - offset, 0);
if(bytesSent == SOCKET_ERROR)
{
return -1;
}
else
{
offset += bytesSent;
}
}
return size;
return size;
}
int network_close(void * network_connection)