--- a/src/memory.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/memory.h	2020-09-15 23:02:48.114069895 -0000
@@ -114,30 +114,30 @@ typedef struct neo_mem {
 	Uint32 watchdog;
 } neo_mem;
 
-neo_mem memory;
+extern neo_mem memory;
 
 /* video related */
 //extern int irq2start, irq2control;
-Uint8 *current_pal;
-Uint32 *current_pc_pal;
-Uint8 *current_fix;
-Uint8 *fix_usage;
+extern Uint8 *current_pal;
+extern Uint32 *current_pc_pal;
+extern Uint8 *current_fix;
+extern Uint8 *fix_usage;
 
 /* sram */
-Uint8 sram_lock;
+extern Uint8 sram_lock;
 //Uint32 sram_protection_hack;
 //int sram_protection_hack;
 
 /* Sound control */
-Uint8 sound_code;
-Uint8 pending_command;
-Uint8 result_code;
+extern Uint8 sound_code;
+extern Uint8 pending_command;
+extern Uint8 result_code;
 
 
 /* 68k cpu Banking control */
 extern Uint32 bankaddress;		/* current bank */
 //Uint8 current_cpu_bank;
-Uint16 z80_bank[4];
+extern Uint16 z80_bank[4];
 
 /* misc utility func */
 void update_all_pal(void);
@@ -263,10 +263,10 @@ void mem68k_store_bk_kof2003_byte(Uint32
 void mem68k_store_bk_kof2003_word(Uint32 addr, Uint16 data);
 void mem68k_store_bk_kof2003_long(Uint32 addr, Uint32 data);
 
-Uint8 (*mem68k_fetch_bksw_byte)(Uint32);
-Uint16 (*mem68k_fetch_bksw_word)(Uint32);
-Uint32 (*mem68k_fetch_bksw_long)(Uint32);
-void (*mem68k_store_bksw_byte)(Uint32,Uint8);
-void (*mem68k_store_bksw_word)(Uint32,Uint16);
-void (*mem68k_store_bksw_long)(Uint32,Uint32);
+extern Uint8 (*mem68k_fetch_bksw_byte)(Uint32);
+extern Uint16 (*mem68k_fetch_bksw_word)(Uint32);
+extern Uint32 (*mem68k_fetch_bksw_long)(Uint32);
+extern void (*mem68k_store_bksw_byte)(Uint32,Uint8);
+extern void (*mem68k_store_bksw_word)(Uint32,Uint16);
+extern void (*mem68k_store_bksw_long)(Uint32,Uint32);
 #endif
--- a/src/video.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/video.h	2020-09-15 23:01:55.756521216 -0000
@@ -67,7 +67,7 @@ typedef struct VIDEO {
 
 #define RASTER_LINES 261
 
-unsigned int neogeo_frame_counter;
+extern unsigned int neogeo_frame_counter;
 extern unsigned int neogeo_frame_counter_speed;
 
 void init_video(void);
--- a/src/memory.c	2011-10-25 18:04:13.000000000 -0000
+++ b/src/memory.c	2020-09-15 23:08:31.083181700 -0000
@@ -896,3 +896,19 @@ void mem68k_store_bk_normal_word(Uint32
 
 LONG_STORE(mem68k_store_bk_normal)
 ;
+Uint8* current_pal;
+Uint32 *current_pc_pal;
+Uint8 *current_fix;
+Uint8 *fix_usage;
+Uint8 sram_lock;
+Uint8 sound_code;
+Uint8 pending_command;
+Uint8 result_code;
+Uint16 z80_bank[4];
+Uint8 (*mem68k_fetch_bksw_byte)(Uint32);
+Uint16 (*mem68k_fetch_bksw_word)(Uint32);
+Uint32 (*mem68k_fetch_bksw_long)(Uint32);
+void (*mem68k_store_bksw_byte)(Uint32,Uint8);
+void (*mem68k_store_bksw_word)(Uint32,Uint16);
+void (*mem68k_store_bksw_long)(Uint32,Uint32);
+neo_mem memory;
--- b/src/video.c	2011-10-25 18:04:13.000000000 -0000
+++ b/src/video.c	2020-09-15 23:09:15.113923583 -0000
@@ -32,6 +32,7 @@
 #include "transpack.h"
 
 extern int neogeo_fix_bank_type;
+unsigned int neogeo_frame_counter;
 
 
 #ifdef PROCESSOR_ARM
--- a/src/screen.c	2011-10-25 18:04:13.000000000 -0000
+++ b/src2/screen.c	2020-09-15 23:14:14.508969030 -0000
@@ -401,3 +401,14 @@ void screen_fullscreen() {
 	fullscreen ^= 1;
 	blitter[nblitter].fullscreen();
 }
+SDL_Surface *screen;
+SDL_Surface *buffer, *sprbuf, *fps_buf, *scan, *fontbuf;
+SDL_Rect visible_area;
+int yscreenpadding;
+Uint8 interpolation;
+Uint8 nblitter;
+Uint8 neffect;
+Uint8 scale;
+Uint8 fullscreen;
+
+
--- a/src/screen.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/screen.h	2020-09-15 23:14:14.085628561 -0000
@@ -17,19 +17,19 @@ extern RGB2YUV rgb2yuv[65536];
 
 void init_rgb2yuv_table(void);
 
-SDL_Surface *screen;
-SDL_Surface *buffer, *sprbuf, *fps_buf, *scan, *fontbuf;
+extern SDL_Surface *screen;
+extern SDL_Surface *buffer, *sprbuf, *fps_buf, *scan, *fontbuf;
 //SDL_Surface *triplebuf[2];
 
-SDL_Rect visible_area;
+extern SDL_Rect visible_area;
 
-int yscreenpadding;
+extern int yscreenpadding;
 
-Uint8 interpolation;
-Uint8 nblitter;
-Uint8 neffect;
-Uint8 scale;
-Uint8 fullscreen;
+extern Uint8 interpolation;
+extern Uint8 nblitter;
+extern Uint8 neffect;
+extern Uint8 scale;
+extern Uint8 fullscreen;
 
 Uint8 get_effect_by_name(char *name);
 Uint8 get_blitter_by_name(char *name);

--- a/src/emu.c	2011-10-25 18:04:13.000000000 -0000
+++ b/src/emu.c	2020-09-15 23:55:31.560725467 -0000
@@ -64,6 +64,11 @@ extern int irq2enable, irq2start, irq2re
 extern int lastirq2line;
 extern int irq2repeat_limit;
 extern Uint32 irq2pos_value;
+Uint8 key[SDLK_LAST];
+Uint8 *joy_button[2];
+Sint32 *joy_axe[2];
+Uint32 joy_numaxes[2];
+conf_type conf;
 
 void setup_misc_patch(char *name) {
 
--- a/src/emu.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/emu.h	2020-09-15 23:55:31.067383834 -0000
@@ -45,7 +45,7 @@ typedef enum COUNTRY {
     CTY_MAX
 } COUNTRY;
 
-struct {
+typedef struct {
     char *game;
     Uint16 x_start;
     Uint16 y_start;
@@ -89,7 +89,8 @@ struct {
 
     int p1_hotkey[4];
     int p2_hotkey[4];
-} conf;
+} conf_type;
+extern conf_type conf;
 
 enum {
     HOTKEY_MASK_A = 0x1,
@@ -123,10 +124,10 @@ enum {
 
 //config conf;
 
-Uint8 key[SDLK_LAST];
-Uint8 *joy_button[2];
-Sint32 *joy_axe[2];
-Uint32 joy_numaxes[2];
+extern Uint8 key[SDLK_LAST];
+extern Uint8 *joy_button[2];
+extern Sint32 *joy_axe[2];
+extern Uint32 joy_numaxes[2];
 
 void debug_loop(void);
 void main_loop(void);
--- a/src/state.c	2011-10-25 18:04:13.000000000 -0000
+++ b/src/state.c	2020-09-15 23:51:12.333025158 -0000
@@ -627,6 +627,7 @@ void clear_state_reg(void) {
 	st_mod[i].reglist=NULL;
     }
 }
+SDL_Surface *state_img;
 
 void neogeo_init_save_state(void) {
     int i;
--- a/src/state.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/state.h	2020-09-15 23:50:09.751969676 -0000
@@ -80,7 +80,7 @@ typedef struct NEOGEO_STATE {
     Uint8 pal1[0x2000], pal2[0x2000];
 }NEOGEO_STATE;
 
-SDL_Surface *state_img;
+extern SDL_Surface *state_img;
 
 #define STREAD  0
 #define STWRITE 1
--- a/src/event.c	2012-01-13 20:25:07.000000000 -0000
+++ b/src/event.c	2020-09-16 00:13:06.148468785 -0000
@@ -10,6 +10,8 @@
 #include "conf.h"
 #include "emu.h"
 #include "memory.h"
+JOYMAP *jmap;
+Uint8 joy_state[2][GN_MAX_KEY];
 
 static int get_mapid(char *butid) {
 	printf("Get mapid %s\n",butid);
--- a/src/event.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/event.h	2020-09-16 00:13:05.125118226 -0000
@@ -41,8 +41,8 @@ typedef struct JOYMAP {
 	struct BUT_MAP **jhat;
 }JOYMAP;
 
-JOYMAP *jmap;
-Uint8 joy_state[2][GN_MAX_KEY];
+extern JOYMAP *jmap;
+extern Uint8 joy_state[2][GN_MAX_KEY];
 
 
 bool init_event(void);
--- a/src/frame_skip.c	2011-10-25 18:04:13.000000000 -0000
+++ b/src/frame_skip.c	2020-09-16 00:14:09.792873267 -0000
@@ -33,6 +33,7 @@
 #ifndef uclock_t
 #define uclock_t Uint32
 #endif
+char fps_str[32];
 
 #define TICKS_PER_SEC 1000000UL
 //#define CPU_FPS 60
--- a/src/frame_skip.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/frame_skip.h	2020-09-16 00:14:10.619553849 -0000
@@ -22,7 +22,7 @@
 
 extern char skip_next_frame;
 
-char fps_str[32];
+extern char fps_str[32];
 
 void reset_frame_skip(void);
 int frame_skip(int init);
--- a/src/transpack.c	2011-10-25 18:04:13.000000000 -0000
+++ b/src/transpack.c	2020-09-16 00:14:41.750077802 -0000
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include "transpack.h"
+TRANS_PACK *tile_trans;
 
 
 static void trans_pack_add(Uint32 begin,Uint32 end,Uint32 type)
--- a/src/transpack.h	2011-10-25 18:04:13.000000000 -0000
+++ b/src/transpack.h	2020-09-16 00:14:41.073399747 -0000
@@ -14,7 +14,7 @@ typedef struct TRANS_PACK {
     Uint8 type;
     struct TRANS_PACK *next;
 } TRANS_PACK;
-TRANS_PACK *tile_trans;
+extern TRANS_PACK *tile_trans;
 
 TRANS_PACK* trans_pack_find(Uint32 tile);
 void trans_pack_open(char *filename);
