From 346a8c36745e4077ff12ae0577c6de9f9511de5f Mon Sep 17 00:00:00 2001 From: GuilhermeWerner <26710260+GuilhermeWerner@users.noreply.github.com> Date: Sun, 18 Apr 2021 20:15:26 -0300 Subject: [PATCH] Add Python Example --- Examples/Python/Main.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Examples/Python/Main.py diff --git a/Examples/Python/Main.py b/Examples/Python/Main.py new file mode 100644 index 0000000..9f0a929 --- /dev/null +++ b/Examples/Python/Main.py @@ -0,0 +1,25 @@ +# Copyright (c) TribuFu. All Rights Reserved + +import platform + +from ctypes import * + +# Windows + +if platform.system() == "Windows": + Library = cdll.LoadLibrary("./Binaries/debug/Library.dll") + +# Linux + +elif platform.system() == "Linux": + Library = cdll.LoadLibrary("./Binaries/debug/libLibrary.so") +# Mac + +elif platform.system() == "Darwin": + Library = cdll.LoadLibrary("./Binaries/debug/libLibrary.dylib") + +Library.Hello.restype = c_char_p + +data = c_char_p("Python".encode('utf-8')) + +print(Library.Hello(data))