From ba980c7cedc9a886d394b81215c279f2b17e475c Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 20 Mar 2019 19:51:57 +0900 Subject: [PATCH] binding of she supports windows --- ffi/python/she.py | 9 +++++---- mklib.bat | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ffi/python/she.py b/ffi/python/she.py index e509f65..ab89752 100644 --- a/ffi/python/she.py +++ b/ffi/python/she.py @@ -26,13 +26,14 @@ def init(curveType=MCL_BN254): global lib name = platform.system() if name == 'Linux': - suf = 'so' + libName = 'libmclshe256.so' elif name == 'Darwin': - suf = 'dylib' + libName = 'libmclshe256.dylib' + elif name == 'Windows': + libName = 'mclshe256.dll' else: raise RuntimeError("not support yet", name) - libname = "libmclshe256." + suf - lib = cdll.LoadLibrary(libname) + lib = cdll.LoadLibrary(libName) ret = lib.sheInit(MCL_BN254, MCLBN_COMPILED_TIME_VAR) if ret != 0: raise RuntimeError("sheInit", ret) diff --git a/mklib.bat b/mklib.bat index b601f15..389b690 100644 --- a/mklib.bat +++ b/mklib.bat @@ -23,6 +23,11 @@ if "%1"=="dll" ( cl /c %CFLAGS% src\bn_c384.cpp /Foobj\bn_c384.obj /DMCLBN_NO_AUTOLINK echo link /nologo /DLL /OUT:bin\mclbn384.dll obj\bn_c384.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn384.lib link /nologo /DLL /OUT:bin\mclbn384.dll obj\bn_c384.obj obj\fp.obj %LDFLAGS% /implib:lib\mclbn384.lib + + echo cl /c %CFLAGS% src\she_c256.cpp /Foobj\she_c256.obj /DMCLBN_NO_AUTOLINK + cl /c %CFLAGS% src\she_c256.cpp /Foobj\she_c256.obj /DMCLBN_NO_AUTOLINK + echo link /nologo /DLL /OUT:bin\mclshe256.dll obj\she_c256.obj obj\fp.obj %LDFLAGS% /implib:lib\mclshe_c256.lib + link /nologo /DLL /OUT:bin\mclshe256.dll obj\she_c256.obj obj\fp.obj %LDFLAGS% /implib:lib\mclshe_c256.lib ) else ( echo cl /c %CFLAGS% src\bn_c256.cpp /Foobj\bn_c256.obj cl /c %CFLAGS% src\bn_c256.cpp /Foobj\bn_c256.obj