- 论坛徽章:
- 24
|
本帖最后由 zhujiang73 于 2016-12-27 22:34 编辑
我也推荐 python, 如果有必要也可以用 boost.python 给 python 写 C++ 扩展模块。 
Synopsis
Welcome to Boost.Python, a C++ library which enables seamless interoperability between C++ and the Python programming language. The library includes support for:
References and Pointers
Globally Registered Type Coercions
Automatic Cross-Module Type Conversions
Efficient Function Overloading
C++ to Python Exception Translation
Default Arguments
Keyword Arguments
Manipulating Python objects in C++
Exporting C++ Iterators as Python Iterators
Documentation Strings
The development of these features was funded in part by grants to Boost Consulting from the Lawrence Livermore National Laboratories and by the Computational Crystallography Initiative at Lawrence Berkeley National Laboratories.
http://www.boost.org/doc/libs/1_ ... doc/html/index.html
- #include <boost/python.hpp>
- using namespace boost::python;
- BOOST_PYTHON_MODULE(hello)
- {
- class_<World>("World")
- .def("greet", &World::greet)
- .def("set", &World::set)
- ;
- }
复制代码
- >>> import hello
- >>> planet = hello.World()
- >>> planet.set('howdy')
- >>> planet.greet()
- 'howdy'
复制代码
|
|