From 3268d1c63df97ae4b5b64a4575259f34b692393f Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 29 Jun 2017 21:28:34 -0400 Subject: [PATCH] more work on linkage --- 4tech_defines.h | 1 + osx_objective_c_to_cpp_links.h | 16 ++++++++-------- platform_mac/mac_4ed.cpp | 14 +++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/4tech_defines.h b/4tech_defines.h index 648c6ad6..3fe56aa9 100644 --- a/4tech_defines.h +++ b/4tech_defines.h @@ -42,6 +42,7 @@ typedef double f64; #define global static #define local_const static const #define global_const static const +#define external extern "C" #define ArrayCount(a) ((sizeof(a))/(sizeof(*a))) #define ExpandArray(a) (a), (ArrayCount(a)) diff --git a/osx_objective_c_to_cpp_links.h b/osx_objective_c_to_cpp_links.h index 20cdc62f..b374b59a 100644 --- a/osx_objective_c_to_cpp_links.h +++ b/osx_objective_c_to_cpp_links.h @@ -41,29 +41,29 @@ typedef struct OSX_Vars{ // In C++ layer. extern OSX_Vars osx; -void* +external void* osx_allocate(umem size); -void +external void osx_resize(int width, int height); -void +external void osx_character_input(u32 code, OSX_Keyboard_Modifiers modifier_flags); -void +external void osx_mouse(i32 mx, i32 my, u32 type); -void +external void osx_mouse_wheel(float dx, float dy); -void +external void osx_step(); -void +external void osx_init(); // In Objective-C layer. -void +external void osx_post_to_clipboard(char *str); #endif diff --git a/platform_mac/mac_4ed.cpp b/platform_mac/mac_4ed.cpp index 945a6c75..9a3a5f3c 100644 --- a/platform_mac/mac_4ed.cpp +++ b/platform_mac/mac_4ed.cpp @@ -18,40 +18,40 @@ OSX_Vars osx; // TODO(allen): Implement a real allocate #include -void* +external void* osx_allocate(umem size){ void *result = malloc(size); return(result); } -void +external void osx_resize(int width, int height){ osx.width = width; osx.height = height; // TODO } -void +external void osx_character_input(u32 code, OSX_Keyboard_Modifiers modifier_flags){ // TODO } -void +external void osx_mouse(i32 mx, i32 my, u32 type){ // TODO } -void +external void osx_mouse_wheel(float dx, float dy){ // TODO } -void +external void osx_step(){ // TODO } -void +external void osx_init(){ // TODO }