Commit d5c4d4a3 authored by Nan Zhang's avatar Nan Zhang
Browse files

<Hermetic> Added Ctypes to allow calling funcs in DLLS.

1. Added Ctypes support for hermetic Python on x86_64 arch. the user has
to be responsible for user shared libs installation. We don't wrap
the user share libs on the .par file since it requires dynamic linker to
be changed to support dl_open with zip offset.

2. Added expat, sqlite3 C-extension modules support for hermetic .par
file as per requested by Daydream team using the expat and sqlite3
modules in Android source tree.

Test: the Python snippet below within .par file has been ran sucessfully.

from ctypes import *
foo = CDLL('/usr/local/google/home/nanzhang/Desktop/ctypes/foo.so')

myprint = foo.myprint
myprint.argtypes = [POINTER(c_char)]
myprint.restype = c_char_p
res = myprint('hello ctypes')
print(res)

add = foo.add
add.argtypes = [c_float, c_float]
add.restype = c_float
print(add(1.3, 1.2))

Bug: b/63388232
Change-Id: I6594d248ad6e792397cb31d5abcd7cfa7e9a46cf
parent ced27516
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment