summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/literals.h
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2017-04-12 10:24:56 +0000
committerkrasimir <krasimir@chalmers.se>2017-04-12 10:24:56 +0000
commita8eaa2f2e560547e63c7976960435e1ae23a22b1 (patch)
tree06ce5fd0bc77a16113b5a53118843216fd3c1aea /src/runtime/c/pgf/literals.h
parent915747efa793e53a7b7e9cfd861b4b4a46ace4a4 (diff)
a patch from Bjørnar Luteberget for compatibility with MSVC
Diffstat (limited to 'src/runtime/c/pgf/literals.h')
-rw-r--r--src/runtime/c/pgf/literals.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/runtime/c/pgf/literals.h b/src/runtime/c/pgf/literals.h
index 7de17b121..624d82f9f 100644
--- a/src/runtime/c/pgf/literals.h
+++ b/src/runtime/c/pgf/literals.h
@@ -1,13 +1,33 @@
#ifndef PGF_LITERALS_H_
#define PGF_LITERALS_H_
+// MSVC requires explicit export/import of
+// symbols in DLLs. CMake takes care of this
+// for functions, but not for data/variables.
+#if defined(_MSC_VER)
+#if defined(COMPILING_PGF)
+#define PGF_API_DATA_DECL __declspec(dllexport)
+#define PGF_API_DATA __declspec(dllexport)
+#else
+#define PGF_API_DATA_DECL __declspec(dllimport)
+#define PGF_API_DATA ERROR_NOT_COMPILING_LIBPGF
+#endif
+
+#else
+
+#define PGF_API_DATA_DECL extern
+#define PGF_API_DATA
+#endif
+// end MSVC workaround
+
+
#include <pgf/data.h>
// literal for named entities recognition
-extern PgfLiteralCallback pgf_nerc_literal_callback;
+PGF_API_DATA_DECL PgfLiteralCallback pgf_nerc_literal_callback;
// literal for finding unknown words
-extern PgfLiteralCallback pgf_unknown_literal_callback;
+PGF_API_DATA_DECL PgfLiteralCallback pgf_unknown_literal_callback;
PgfCCat*
pgf_literal_cat(PgfConcr* concr, PgfLiteral lit);