From 69c70694aad4e565119fed23dc1b9f4438eafd3b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 26 Jan 2023 08:20:14 +0100 Subject: [PATCH] define COMPILING_STATIC_PGF for MSVC --- src/runtime/c/pgf/pgf.h | 20 ++++++++++++-------- src/runtime/python/setup.py | 4 +++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/runtime/c/pgf/pgf.h b/src/runtime/c/pgf/pgf.h index c8676ef1b..7266be500 100644 --- a/src/runtime/c/pgf/pgf.h +++ b/src/runtime/c/pgf/pgf.h @@ -12,6 +12,9 @@ #if defined(COMPILING_PGF) #define PGF_API_DECL EXTERN_C __declspec(dllexport) #define PGF_API EXTERN_C __declspec(dllexport) +#elif defined(COMPILING_STATIC_PGF) +#define PGF_API_DECL +#define PGF_API #else #define PGF_API_DECL __declspec(dllimport) #define PGF_API ERROR_NOT_COMPILING_LIBPGF @@ -68,6 +71,7 @@ typedef enum { PGF_EXN_NONE, PGF_EXN_SYSTEM_ERROR, PGF_EXN_PGF_ERROR, + PGF_EXN_TYPE_ERROR, PGF_EXN_OTHER_ERROR } PgfExnType; @@ -474,10 +478,10 @@ PGF_API_DECL void pgf_release_phrasetable_ids(PgfPhrasetableIds *seq_ids); PGF_API_DECL -void pgf_check_expr(PgfDB *db, PgfRevision revision, - PgfExpr* pe, PgfType ty, - PgfMarshaller *m, PgfUnmarshaller *u, - PgfExn *err); +PgfExpr pgf_check_expr(PgfDB *db, PgfRevision revision, + PgfExpr e, PgfType ty, + PgfMarshaller *m, PgfUnmarshaller *u, + PgfExn *err); PGF_API_DECL PgfType pgf_infer_expr(PgfDB *db, PgfRevision revision, @@ -486,10 +490,10 @@ PgfType pgf_infer_expr(PgfDB *db, PgfRevision revision, PgfExn *err); PGF_API_DECL -void pgf_check_type(PgfDB *db, PgfRevision revision, - PgfType* pty, - PgfMarshaller *m, PgfUnmarshaller *u, - PgfExn *err); +PgfType pgf_check_type(PgfDB *db, PgfRevision revision, + PgfType ty, + PgfMarshaller *m, PgfUnmarshaller *u, + PgfExn *err); PGF_API_DECL PgfRevision pgf_start_transaction(PgfDB *db, PgfExn *err); diff --git a/src/runtime/python/setup.py b/src/runtime/python/setup.py index 1c3069bd8..cac73e027 100644 --- a/src/runtime/python/setup.py +++ b/src/runtime/python/setup.py @@ -15,8 +15,10 @@ if on_windows: cpath = '../c/pgf/' extra_sources = [cpath+f for f in os.listdir(cpath) if f.endswith('.cxx')] includes+=["../c"] + flags = ['/DCOMPILING_STATIC_PGF=1'] else: extra_sources = [] + flags = ['-std=c99', '-Werror', '-Wno-error=unused-variable', '-Wno-comment'] pgf_module = Extension( 'pgf', @@ -26,7 +28,7 @@ pgf_module = Extension( 'ffi.c', 'transactions.c' ]+extra_sources, - extra_compile_args = [] if on_windows else ['-std=c99', '-Werror', '-Wno-error=unused-variable', '-Wno-comment'], + extra_compile_args = flags, include_dirs = includes, library_dirs = libraries, libraries = [] if on_windows else ['pgf'])