From 48da30a25f126331bc99f1fef194d167a1f9fe77 Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Mon, 23 Nov 2015 20:21:11 +0100 Subject: [PATCH] Fixed Windows version --- README.md | 2 +- src/lib.rs | 11 ++++++++++- src/native/windows/WinMiniFB.c | 2 -- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e1e92a2..238cb15 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ fn main() { Status ------ -Currently Mac has been tested. Windows and Linux will be tested and verified soon. +Currently Mac and Windows has been tested. Linux will be tested and verified soon. Build instructions diff --git a/src/lib.rs b/src/lib.rs index 42b444b..9a66e41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,14 +3,23 @@ use std::ffi::CString; use std::mem::transmute; use libc::{c_char, c_int, c_void}; +#[cfg(target_os = "macos")] #[link(name = "Cocoa", kind = "framework")] -#[link(name = "minifb_native")] extern { fn mfb_open(name: *const c_char, width: c_int, height: c_int) -> c_int; fn mfb_update(buffer: *mut c_void) -> c_int; fn mfb_close(); } +#[cfg(target_os = "windows")] +#[link(name = "gdi32")] +extern { + fn mfb_open(name: *const c_char, width: c_int, height: c_int) -> c_int; + fn mfb_update(buffer: *mut c_void) -> c_int; + fn mfb_close(); +} + + /// /// Open up a window /// diff --git a/src/native/windows/WinMiniFB.c b/src/native/windows/WinMiniFB.c index bca2597..2a25508 100644 --- a/src/native/windows/WinMiniFB.c +++ b/src/native/windows/WinMiniFB.c @@ -1,5 +1,3 @@ -#include - #define WIN32_LEAN_AND_MEAN #include