GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — learning-python/pybind11 at master · feixiao/learning-python

Expand file tree

/

pybind11

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

pybind11

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
ReadMe.md
ReadMe.md
 
 
pybind11_sum.cpp
pybind11_sum.cpp
 
 
test_pybind.py
test_pybind.py
 
 

ReadMe.md

Outline

pybind11入门

Python和C/C++ 交互

底层控制的核心在于绕过Python解释器的常规机制,直接操作内存、线程、系统资源等。推荐优先使用PyBind11简化开发,但在需要极致性能或直接操作系统时,需结合Python/C API或ctypes实现精细控制。

  • 《一文总结Python和C/C++的交互方式》
  • 《pybind11_examples》 Examples for the usage of "pybind11"

安装pybind11

pip install pybind11==2.10.1

编译

# -undefined dynamic_lookup -arch x86_64
g++ -O3 -Wall -shared -std=c++11 -fPIC -undefined dynamic_lookup $(python3 -m pybind11 --includes) pybind11_sum.cpp -o pybind11_sum$(python3-config --extension-suffix) 
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.