用户工具

站点工具


linux:python:使用swig连接python与c

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
linux:python:使用swig连接python与c [2020/10/21 12:40] zhangguolinux:python:使用swig连接python与c [2023/03/17 10:12] (当前版本) – 外部编辑 127.0.0.1
行 84: 行 84:
  
  
 +==== - 语法参考 ====
  
 +http://vmcc.vicp.net:9090/python/c-api/bytes.html
  
 +http://vmcc.vicp.net:9090/python/c-api/concrete.html#sequence-objects
  
 +
 +==== - 相关function ====
 +<code c>
 +PyObject* PyBytes_FromStringAndSize(const char *v, Py_ssize_t len)
 +//Return value: New reference.
 +//Return a new bytes object with a copy of the string v as value and length len on success, and NULL on failure. If v is NULL, the contents of the bytes object are uninitialized.
 +
 +
 +
 +PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
 +//Return value: New reference.
 +//Create a new bytearray object from string and its length, len. On failure, NULL is returned.
 +
 +
 +
 +PyObject* PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
 +//Return value: New reference.
 +//Create a Unicode object from the char buffer u. The bytes will be interpreted as being UTF-8 encoded. The buffer is copied into the new object. If the buffer is not NULL, the return value might be a shared object, i.e. modification of the data is not allowed.
 +
 +//If u is NULL, this function behaves like PyUnicode_FromUnicode() with the buffer set to NULL. This usage is deprecated in favor of PyUnicode_New().
 +</code>
linux/python/使用swig连接python与c.1603255207.txt.gz · 最后更改: 2023/03/17 10:12 (外部编辑)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki