Created
February 25, 2012 16:24
-
-
Save knzm/1909346 to your computer and use it in GitHub Desktop.
Windows で Zinnia をスタティックリンクするためのパッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: mmap.h | |
=================================================================== | |
--- mmap.h (リビジョン 16) | |
+++ mmap.h (作業コピー) | |
@@ -112,7 +112,11 @@ | |
CHECK_CLOSE_FALSE(false) << "unknown open mode:" << filename; | |
} | |
- hFile = CreateFile(filename, mode1, FILE_SHARE_READ, 0, | |
+ size_t len = 0; | |
+ errno_t err = 0; | |
+ WCHAR wcFilename[MAX_PATH]; | |
+ mbstowcs_s(&len, wcFilename, sizeof(wcFilename), filename, _TRUNCATE); | |
+ hFile = CreateFile(wcFilename, mode1, FILE_SHARE_READ, 0, | |
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); | |
CHECK_CLOSE_FALSE(hFile != INVALID_HANDLE_VALUE) | |
<< "CreateFile() failed: " << filename; | |
Index: trainer.cpp | |
=================================================================== | |
--- trainer.cpp (リビジョン 16) | |
+++ trainer.cpp (作業コピー) | |
@@ -10,6 +10,7 @@ | |
#include <fstream> | |
#include <set> | |
#include <string> | |
+#include <iterator> | |
#include "scoped_ptr.h" | |
#include "common.h" | |
#include "svm.h" | |
Index: zinnia.h | |
=================================================================== | |
--- zinnia.h (リビジョン 16) | |
+++ zinnia.h (作業コピー) | |
@@ -19,7 +19,7 @@ | |
extern "C" { | |
#endif | |
-#ifdef _WIN32 | |
+#if defined(_WIN32) && defined(ZINNIA_USE_DLLS) | |
#include <windows.h> | |
# ifdef DLL_EXPORT | |
# define ZINNIA_DLL_EXTERN __declspec(dllexport) | |
@@ -135,7 +135,7 @@ | |
#ifndef SWIG | |
virtual bool parse(const char *str, size_t length) = 0; | |
virtual bool toString(char *buf, size_t length) const = 0; | |
-#ifdef _WIN32 | |
+#if defined(_WIN32) && defined(ZINNIA_USE_DLLS) | |
ZINNIA_DLL_EXTERN | |
#endif | |
static Character *create(); | |
@@ -162,7 +162,7 @@ | |
virtual const char *what() = 0; | |
virtual ~Recognizer() {} | |
#ifndef SWIG | |
-#ifdef _WIN32 | |
+#if defined(_WIN32) && defined(ZINNIA_USE_DLLS) | |
ZINNIA_DLL_EXTERN | |
#endif | |
static Recognizer* create(); | |
@@ -174,13 +174,13 @@ | |
virtual bool add(const Character &character) = 0; | |
virtual void clear() = 0; | |
virtual bool train(const char *filename) = 0; | |
-#ifdef _WIN32 | |
+#if defined(_WIN32) && defined(ZINNIA_USE_DLLS) | |
ZINNIA_DLL_EXTERN | |
#endif | |
static bool convert(const char *txt_model, | |
const char *binary_model, | |
double compression_threshold); | |
-#ifdef _WIN32 | |
+#if defined(_WIN32) && defined(ZINNIA_USE_DLLS) | |
ZINNIA_DLL_EXTERN | |
#endif | |
static bool makeHeader(const char *txt_model, | |
@@ -190,7 +190,7 @@ | |
virtual const char *what() = 0; | |
virtual ~Trainer() {} | |
#ifndef SWIG | |
-#ifdef _WIN32 | |
+#if defined(_WIN32) && defined(ZINNIA_USE_DLLS) | |
ZINNIA_DLL_EXTERN | |
#endif | |
static Trainer* create(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good it can resolve my questions