Guest User

Untitled

a guest
Nov 28th, 2018
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2.  
  3. from ctypes import  *
  4.  
  5. lib = cdll.LoadLibrary('./libfoo.so')
  6.  
  7.  
  8. class Foo(object):
  9.     def __init__(self):
  10.         self.obj = lib.Foo_new()
  11.         lib.Foo_bar.restype = c_double
  12.  
  13.     def bar(self, a, b, c, d):        
  14.         return lib.Foo_bar(self.obj, c_double(a), c_double(b), c_double(c), c_double(d))
  15.  
  16.  
  17. f = Foo()
  18. a = 1
  19. b = 2.5
  20. c = 3.5
  21. d = 3.5
  22.  
  23. print f.bar(a, b, c, d)
RAW Paste Data