From 72d5fc86b6a13fd97646cb6decd1064154f4776b Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 12 Feb 2019 18:01:15 -0800 Subject: [PATCH 1/2] fix for windows for CT FFI --- gcc/closures.c | 2 +- libffi.nim | 8 +++++++- libffi.nimble | 9 ++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gcc/closures.c b/gcc/closures.c index c0ee068..f12013e 100644 --- a/gcc/closures.c +++ b/gcc/closures.c @@ -108,7 +108,7 @@ #include #include #ifndef _MSC_VER -#include +//#include #endif #include #include diff --git a/libffi.nim b/libffi.nim index 3533c9e..7ca481c 100644 --- a/libffi.nim +++ b/libffi.nim @@ -10,8 +10,14 @@ {.deadCodeElim: on.} when defined(windows): + import os # on Windows we don't use a DLL but instead embed libffi directly: - {.pragma: mylib, header: r"ffi.h".} + + const thisPath = currentSourcePath.parentDir + const flag = "-I" & (thisPath / "common") & " -I" & thisPath + {.passC: flag.} + + {.pragma: mylib, header: r"common/ffi.h".} #{.compile: r"common\malloc_closure.c".} {.compile: r"common\raw_api.c".} diff --git a/libffi.nimble b/libffi.nimble index 9b128a9..c33a7f7 100644 --- a/libffi.nimble +++ b/libffi.nimble @@ -1,9 +1,8 @@ -[Package] -name = "libffi" -version = "1.0.0" +# Package +version = "1.0.1" author = "Andreas Rumpf" description = "libffi wrapper for Nim." license = "MIT" -[Deps] -Requires: "nim >= 0.10.0" +# Dependencies +requires "nim >= 0.10.0" From 43b223875b4839b37dffba6528a2eb10d9e43fbf Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 12 Feb 2019 18:34:56 -0800 Subject: [PATCH 2/2] fixup --- libffi.nimble | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libffi.nimble b/libffi.nimble index c33a7f7..f0d24e8 100644 --- a/libffi.nimble +++ b/libffi.nimble @@ -4,5 +4,8 @@ author = "Andreas Rumpf" description = "libffi wrapper for Nim." license = "MIT" +when defined(windows): + installExt = @["nim", "c", "h", "s"] + # Dependencies requires "nim >= 0.10.0"