Python??C???????
???????????? ???????[ 2016/5/10 14:03:42 ] ????????.NET ???????????
?????????c????python???
???????????python????е????c?ж????????????????c?ж??????python??飬?????????import?????飬???????????????????c?ж????????????磬???????c????????????????data?????????????????????SetData??GetData?????????£????????????е???SetData??GetData??????????data?????????????????????????е???SetData??GetData????????????????е???????????????????????data???python???????????????????????
1 #define min(a??b) (((a) < (b)) ? (a) : (b))
2
3 char data[1024];
4
5 void SetData(const char *str)
6 {
7 strncpy(data?? str?? min(strlen(str) + 1?? 1024));
8 }
9
10 const char *GetData()
11 {
12 return data;
13 }
??????c?ж??????python????????????裬??????????£?
1 PyDoc_STRVAR(PySetData_doc__?? "
2 ????
3
4 PySetData(str)
5 str: ??????????
6 ????:
7 null
8 ");
9 static PyObject* PySetData(PyObject *self?? PyObject *args)
10 {
11 const char* str = NULL;
12 if ( !PyArg_ParseTuple(args?? "s"?? &str) )
13 {
14 return 0;
15 }
16 SetData(str);
17 Py_RETURN_NONE;
18 }
19
20 PyDoc_STRVAR(PyGetData_doc__?? "
21 ???????
22
23 PyGetData()
24 ????:
25 data
26 ");
27 static PyObject* PyGetData(PyObject *self?? PyObject *args)
28 {
29 const char* str = NULL;
30 return PyString_FromString(GetData());
31 }
32
33 static PyMethodDef module_methods[] = {
34 {"py_set_data"?? PySetData?? METH_VARARGS?? PySetData_doc__}??
35 {"py_get_data"?? PyGetData?? METH_VARARGS?? PyGetData_doc__}??
36 {NULL}
37 };
38 void InitCCallPy()
39 {
40 PyObject *module = Py_InitModule3("pycallc"?? module_methods??
41 "python call c");
42 }
????Py_InitModule3???????????python??飬???????????????????????????????????е?????????????????????????????????????????????????????????????pycallc????飬????????????module_methods??????????????py_set_data??py_get_data?????????????????????????PySetData??PyGetData??????????????????????漲???SetData??GetData????????????python????????pycallc????py_set_data??py_get_data???????????ú???data??????????????????????????python??????????????c?ж?????????????Σ??????????????python???
??????python????е???c????python???
?????????????????c?????????????python???pycallc?????????????????????import?????????飬?????????????е????????????????£?
1 # -*- coding: utf-8 -*-
2
3 import pycallc
4
5 def test():
6 print 'in python : '?? pycallc.py_get_data()
7 pycallc.py_set_data("change hello world!")
???????????????????python????е???c?е??????
?????????????????demo???????https://github.com/morningstatus/python/tree/master/ccallpy
???????
??????????c????python??python????c??????????Щ???????裬????????????л??????????????????????????н??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???Java??????????Python??????300??Python?????????y?????????????ж????д???Python???Python???????????????????????????????????pythonС???????python????HP??Quality CenterPython??Anaconda??????????????·??Ubuntu ???????Python??????????μ?????????????????????pythonpython unittest??????????????????Pythonд???NoSQL?????python unittest?????????????????????????Python??JIRA?????JIRAAppium+Python????????????????Python????????????е?????????????????Python??SQLite?????????????????Ч?????????ξ??饗Python?棩
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????