Skip to content

Instantly share code, notes, and snippets.

@yuyichao
Created October 5, 2014 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuyichao/b054dc909f4712d11761 to your computer and use it in GitHub Desktop.
Save yuyichao/b054dc909f4712d11761 to your computer and use it in GitHub Desktop.
{
"metadata": {
"name": "",
"signature": "sha256:11e8b8cbd1204e31844d1ba679a17aa92ed7f61d9670164bb5bbd7034529ec7c"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from cffi import FFI\n",
"\n",
"ffi = FFI()\n",
"\n",
"ffi2 = FFI()\n",
"\n",
"ffi.cdef('int f();')\n",
"ffi2.cdef('int f();')\n",
"\n",
"lib = ffi.verify('''\n",
"int f()\n",
"{\n",
" return 1;\n",
"}\n",
"''')\n",
"\n",
"lib2 = ffi2.verify('''\n",
"int f()\n",
"{\n",
" return 2;\n",
"}\n",
"''')\n",
"\n",
"print(lib.f())\n",
"print(lib2.f())"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"1\n",
"2\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment