#! /usr/bin/env python #coding: utf-8 import platform from ctypes import * ### a Add b def Add(a, b): state = True value = 0 try: os_name = platform.system() os_name = os_name.lower() print os_name if os_name == "linux": dll = CDLL("./add_linux.so") elif os_name == "windows": dll = CDLL("./add_win.dll") value = dll.Add(a, b) except: state = False return state, value