From 0154c07df2f82e44333401ab7bee53563cfefd3d Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Sun, 9 Feb 2014 12:07:39 +0000
Subject: [PATCH] Do the DLL im/ex-port dance.

---
 src/conio/CMakeLists.txt |  2 ++
 src/conio/ciolib.h       | 24 ++++++++++++------------
 src/conio/mouse.c        | 30 +++++++++++++++---------------
 3 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/src/conio/CMakeLists.txt b/src/conio/CMakeLists.txt
index beeb98b149..278e9c8130 100644
--- a/src/conio/CMakeLists.txt
+++ b/src/conio/CMakeLists.txt
@@ -58,6 +58,8 @@ target_include_directories(ciolib PRIVATE "${XPDev_DIR}/../../../include/xpdev")
 target_compile_definitions(ciolib PRIVATE $<TARGET_PROPERTY:xpdev,INTERFACE_COMPILE_DEFINITIONS>)
 target_include_directories(ciolib PRIVATE $<TARGET_PROPERTY:xpdev,INTERFACE_INCLUDE_DIRECTORIES>)
 target_link_libraries(ciolib xpdev)
+target_compile_definitions(ciolib PRIVATE CIOLIB_EXPORTS)
+target_compile_definitions(ciolib INTERFACE CIOLIB_IMPORTS)
 
 if(SDL_FOUND)
 	target_include_directories(ciolib PRIVATE ${SDL_INCLUDE_DIR})
diff --git a/src/conio/ciolib.h b/src/conio/ciolib.h
index f9ac3946df..bd55dbd2e4 100644
--- a/src/conio/ciolib.h
+++ b/src/conio/ciolib.h
@@ -493,18 +493,18 @@ extern int ciolib_mouse_initialized;
 #ifdef __cplusplus
 extern "C" {
 #endif
-void ciomouse_gotevent(int event, int x, int y);
-int mouse_trywait(void);
-int mouse_wait(void);
-int mouse_pending(void);
-int ciolib_getmouse(struct mouse_event *mevent);
-int ciolib_ungetmouse(struct mouse_event *mevent);
-void ciolib_mouse_thread(void *data);
-int ciomouse_setevents(int events);
-int ciomouse_addevents(int events);
-int ciomouse_delevents(int events);
-int ciomouse_addevent(int event);
-int ciomouse_delevent(int event);
+CIOLIBEXPORT void CIOLIBCALL ciomouse_gotevent(int event, int x, int y);
+CIOLIBEXPORT int CIOLIBCALL mouse_trywait(void);
+CIOLIBEXPORT int CIOLIBCALL mouse_wait(void);
+CIOLIBEXPORT int CIOLIBCALL mouse_pending(void);
+CIOLIBEXPORT int CIOLIBCALL ciolib_getmouse(struct mouse_event *mevent);
+CIOLIBEXPORT int CIOLIBCALL ciolib_ungetmouse(struct mouse_event *mevent);
+CIOLIBEXPORT void CIOLIBCALL ciolib_mouse_thread(void *data);
+CIOLIBEXPORT int CIOLIBCALL ciomouse_setevents(int events);
+CIOLIBEXPORT int CIOLIBCALL ciomouse_addevents(int events);
+CIOLIBEXPORT int CIOLIBCALL ciomouse_delevents(int events);
+CIOLIBEXPORT int CIOLIBCALL ciomouse_addevent(int event);
+CIOLIBEXPORT int CIOLIBCALL ciomouse_delevent(int event);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/conio/mouse.c b/src/conio/mouse.c
index 5d5df3ea76..eb6aad6c7c 100644
--- a/src/conio/mouse.c
+++ b/src/conio/mouse.c
@@ -100,7 +100,7 @@ int ciolib_mouse_initialized=0;
 static int ungot=0;
 pthread_mutex_t unget_mutex;
 
-void init_mouse(void)
+void CIOLIBCALL init_mouse(void)
 {
 	memset(&state,0,sizeof(state));
 	state.click_timeout=0;
@@ -111,37 +111,37 @@ void init_mouse(void)
 	ciolib_mouse_initialized=1;
 }
 
-int ciomouse_setevents(int events)
+int CIOLIBCALL ciomouse_setevents(int events)
 {
 	mouse_events=events;
 	return mouse_events;
 }
 
-int ciomouse_addevents(int events)
+int CIOLIBCALL ciomouse_addevents(int events)
 {
 	mouse_events |= events;
 	return mouse_events;
 }
 
-int ciomouse_delevents(int events)
+int CIOLIBCALL ciomouse_delevents(int events)
 {
 	mouse_events &= ~events;
 	return mouse_events;
 }
 
-int ciomouse_addevent(int event)
+int CIOLIBCALL ciomouse_addevent(int event)
 {
 	mouse_events |= (1<<event);
 	return mouse_events;
 }
 
-int ciomouse_delevent(int event)
+int CIOLIBCALL ciomouse_delevent(int event)
 {
 	mouse_events &= ~(1<<event);
 	return mouse_events;
 }
 
-void ciomouse_gotevent(int event, int x, int y)
+void CIOLIBCALL ciomouse_gotevent(int event, int x, int y)
 {
 	struct in_mouse_event *ime;
 
@@ -157,7 +157,7 @@ void ciomouse_gotevent(int event, int x, int y)
 	listPushNode(&state.input,ime);
 }
 
-void add_outevent(int event, int x, int y)
+void CIOLIBCALL add_outevent(int event, int x, int y)
 {
 	struct out_mouse_event *ome;
 	int	but;
@@ -179,7 +179,7 @@ void add_outevent(int event, int x, int y)
 	listPushNode(&state.output,ome);
 }
 
-int more_multies(int button, int clicks)
+int CIOLIBCALL more_multies(int button, int clicks)
 {
 	switch(clicks) {
 		case 0:
@@ -198,7 +198,7 @@ int more_multies(int button, int clicks)
 	return(0);
 }
 
-void ciolib_mouse_thread(void *data)
+void CIOLIBCALL ciolib_mouse_thread(void *data)
 {
 	int	timedout;
 	int timeout_button=0;
@@ -431,7 +431,7 @@ void ciolib_mouse_thread(void *data)
 	}
 }
 
-int mouse_trywait(void)
+int CIOLIBCALL mouse_trywait(void)
 {
 	int	result;
 
@@ -449,7 +449,7 @@ int mouse_trywait(void)
 	}
 }
 
-int mouse_wait(void)
+int CIOLIBCALL mouse_wait(void)
 {
 	int result;
 
@@ -467,14 +467,14 @@ int mouse_wait(void)
 	}
 }
 
-int mouse_pending(void)
+int CIOLIBCALL mouse_pending(void)
 {
 	while(!ciolib_mouse_initialized)
 		SLEEP(1);
 	return(listCountNodes(&state.output));
 }
 
-int ciolib_getmouse(struct mouse_event *mevent)
+int CIOLIBCALL ciolib_getmouse(struct mouse_event *mevent)
 {
 	int retval=0;
 
@@ -505,7 +505,7 @@ int ciolib_getmouse(struct mouse_event *mevent)
 	return(retval);
 }
 
-int ciolib_ungetmouse(struct mouse_event *mevent)
+int CIOLIBCALL ciolib_ungetmouse(struct mouse_event *mevent)
 {
 	struct mouse_event *me;
 
-- 
GitLab