From b7f227327d243e47aef77d27bd938983823b7499 Mon Sep 17 00:00:00 2001
From: Patrik Gebhardt
Date: Tue, 26 Apr 2016 13:32:26 +0200
Subject: [PATCH] python to rust example now works on windows
---
python-to-rust/src/main.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/python-to-rust/src/main.py b/python-to-rust/src/main.py
index 31fb1af..fc0d00e 100644
--- a/python-to-rust/src/main.py
+++ b/python-to-rust/src/main.py
@@ -1,14 +1,19 @@
from ctypes import cdll
from sys import platform
-if platform == "darwin":
- ext = "dylib"
+if platform == 'darwin':
+ prefix = 'lib'
+ ext = 'dylib'
+elif platform == 'win32':
+ prefix = ''
+ ext = 'dll'
else:
- ext = "so"
+ prefix = 'lib'
+ ext = 'so'
-lib = cdll.LoadLibrary('target/debug/libdouble_input.' + ext)
+lib = cdll.LoadLibrary('target/debug/{}double_input.{}'.format(prefix, ext))
double_input = lib.double_input
input = 4
output = double_input(input)
-print(str(input) + " * 2 = " + str(output))
+print('{} * 2 = {}'.format(input, output))