Author: Wim Lavrijsen <wlavrij...@lbl.gov> Branch: Changeset: r56479:169eb17f9894 Date: 2012-07-26 11:40 -0700 http://bitbucket.org/pypy/pypy/changeset/169eb17f9894/
Log: linking example code did not work as expected; use alternative diff --git a/pypy/doc/cppyy.rst b/pypy/doc/cppyy.rst --- a/pypy/doc/cppyy.rst +++ b/pypy/doc/cppyy.rst @@ -338,7 +338,7 @@ $ genreflex example.h --deep --rootmap=libexampleDict.rootmap --rootmap-lib=libexampleDict.so $ g++ -fPIC -rdynamic -O2 -shared -I$ROOTSYS/include example_rflx.cpp -o libexampleDict.so -L$ROOTSYS/lib -lReflex -.. _`example code`: example.h +.. _`example code`: cppyy_example.html * **abstract classes**: Are represented as python classes, since they are needed to complete the inheritance hierarchies, but will raise an exception diff --git a/pypy/doc/cppyy_example.rst b/pypy/doc/cppyy_example.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/cppyy_example.rst @@ -0,0 +1,56 @@ +// File: example.h:: + + #include <iostream> + #include <vector> + + class AbstractClass { + public: + virtual ~AbstractClass() {} + virtual void abstract_method() = 0; + }; + + class ConcreteClass : AbstractClass { + public: + ConcreteClass(int n=42) : m_int(n) {} + ~ConcreteClass() {} + + virtual void abstract_method() { + std::cout << "called concrete method" << std::endl; + } + + void array_method(int* ad, int size) { + for (int i=0; i < size; ++i) + std::cout << ad[i] << ' '; + std::cout << std::endl; + } + + void array_method(double* ad, int size) { + for (int i=0; i < size; ++i) + std::cout << ad[i] << ' '; + std::cout << std::endl; + } + + AbstractClass* show_autocast() { + return this; + } + + operator const char*() { + return "Hello operator const char*!"; + } + + public: + int m_int; + }; + + namespace Namespace { + + class ConcreteClass { + public: + class NestedClass { + public: + std::vector<int> m_v; + }; + + }; + + } // namespace Namespace _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit