From 844520a4026b2a57e22a67d7880cc12867507156 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 25 Jan 2013 07:57:57 -0700 Subject: [PATCH] fix embed.cpp build for 64-bit Windows --- src/embed.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/embed.cpp b/src/embed.cpp index a4a32bb6d7..293169ce78 100644 --- a/src/embed.cpp +++ b/src/embed.cpp @@ -17,8 +17,14 @@ #include "embed.h" -extern "C" const uint8_t binary_loader_start[]; -extern "C" const uint8_t binary_loader_end[]; +#ifdef __x86_64__ +# define BINARY_LOADER(x) _binary_loader_##x +#else +# define BINARY_LOADER(x) binary_loader_##x +#endif + +extern "C" const uint8_t BINARY_LOADER(start)[]; +extern "C" const uint8_t BINARY_LOADER(end)[]; __declspec(noreturn) void printUsage(const wchar_t* executableName) @@ -31,8 +37,8 @@ void writeDestinationFile(const wchar_t* filename) { if(FILE* file = _wfopen(filename, L"wb")) { - size_t count = binary_loader_end - binary_loader_start; - if(count == fwrite(binary_loader_start, sizeof(binary_loader_start[0]), count, file)) + size_t count = BINARY_LOADER(end) - BINARY_LOADER(start); + if(count == fwrite(BINARY_LOADER(start), sizeof(BINARY_LOADER(start)[0]), count, file)) { fclose(file); return;