Browse Source

Working on FFI examples

master
Drew Short 5 years ago
parent
commit
464579078f
  1. 10
      FFI-tests/ffi_test.py
  2. 4
      starter_file.rs

10
FFI-tests/ffi_test.py

@ -1,6 +1,7 @@
#!/usr/bin/env python3
from ctypes import *
from sys import exit, platform
import os
large_image1_path = "../test_images/sample_01_large.jpg".encode(encoding="utf-8")
@ -33,12 +34,17 @@ print("starting ffi test")
# Load the shared library
lib = None
if os.name == 'nt':
if platform == 'win32':
path = os.path.dirname(__file__) + "\\pihash.dll"
print(path)
lib = CDLL(path)
else:
elif platform == 'darwin':
lib = cdll.LoadLibrary("libpihash.dylib")
elif platform == 'linux' or platform == 'linux2':
lib = cdll.LoadLibrary("libpihash.so")
else:
print('Unrecognized platform ', platform)
sys.exit(-1)
class PIHashes(Structure):

4
starter_file.rs

@ -1,4 +0,0 @@
// Copyright 2015 Drew Short <drew@sothr.com>.
//
// Licensed under the MIT license<LICENSE-MIT or http://opensource.org/licenses/MIT>.
// This file may not be copied, modified, or distributed except according to those terms.
Loading…
Cancel
Save