我嘗試了鏈接:Calling C/C++ from python?,但我無法做到這一點,在這裏我有extern「C」.so請求建議假設我有函數稱爲'function.cpp',我必須在python代碼中調用這個函數。 function.cpp是:如何從Python中調用類的C++函數
int max(int num1, int num2)
{
// local variable declaration
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
那又怎麼可以調用蟒蛇這個功能,因爲我是新的C++。我聽說過'cython',但我不知道它。
檢查[boost python庫](http://www.boost.org/doc/libs/1_55_0/libs/python/doc/v2/reference.html) –
只需使用python ['max()'](https: //docs.python.org/2/library/functions.html#max) – clcto
@clcto其實我有另一個ADC的大代碼是在c + +,但我使用python進行編碼,所以我必須調用C++代碼在python中。上面的C++函數只是個例子 – lkkkk