import sys
import os
from subprocess import Popen, PIPE
from cffi import FFI


def _get_library_suffix():
    if sys.platform == "darwin":
        return 'dylib'
    else:
        return 'so'


def get_lib_handle(definitions, header, library, build_dir, include_dir):
    ffi = FFI()
    interface = Popen(['cc', '-E'] + definitions + [os.path.join(include_dir, header)],
                      stdout=PIPE).communicate()[0].decode("utf-8")
    ffi.cdef(interface)

    suffix = _get_library_suffix()
    lib = ffi.dlopen(os.path.join(build_dir, 'lib{0}.{1}'.format(library, suffix)))
    return lib

@@ -236,21 +236,23 @@
 ibrary, 
-build
+library
 _dir, in
@@ -287,26 +287,18 @@
     
-interface = Popen(
+command = 
 %5B'cc
@@ -361,31 +361,39 @@
 er)%5D
-,
 %0A    
-                 
+interface = Popen(command,
  std
@@ -459,17 +459,16 @@
 erface)%0A
-%0A
     suff
@@ -505,45 +505,79 @@
  lib
- = ffi.dlopen(os.path.join(build_dir,
+_file_name = os.path.join(library_dir,%0A                                
  'li
@@ -610,16 +610,51 @@
 suffix))
+%0A    lib = ffi.dlopen(lib_file_name
 )%0A    re

update cffi_helpers.py