From: Barry S. <ba...@ba...> - 2017-06-05 20:07:39
|
> On 5 Jun 2017, at 06:05, madan kumar yelburgi <mad...@gm...> wrote: > > Hi, > I'm new to pycxx and i installed and ran the demos using pycxx 7.0.2. > > But i did not get how can you use pycxx extension in a c++ code like say "hello world" in visual studio and how do you call it in a command window or a python interpreter. > > I really did not understand from the demo examples and their building. so can you please give me suggestion, how can this be achieved. > > I tried building using setup.py in my file and try to build but didn't get it and there's not much videos or snippets of pycxx basic examples except the demos in installed folder, which i found hard to understand. Please help me in this. > > Any Links to basic c++ example with pycxx extension and the way how it's called in the interpreter would give me a good understanding Opss did not mean to send that email unfinshed. Given you have built pycxx examples I suggest you look at Demo/python3/simple.cxx. From python3 you can import simple to play with the code. There are 3 things to pay attention to: 1) the module at line 215 2) the module level func at line 274 3) the class at line 21 and its different types of functions. Here is what I do on mac to test. $ python3.6 setup_makefile.py macosx Makefile $ make clean $ make test And to play with simple module: $ PYTHONPATH=obj python3.6 Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import simple sizeof(int) 4 sizeof(long) 8 sizeof(Py_hash_t) 8 sizeof(Py_ssize_t) 8 >>> simple.func() func Called with 0 normal arguments. and with 0 keyword arguments: >>> Barry > > Thanks, > Madan > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ > CXX-Users mailing list > CXX...@li... > https://lists.sourceforge.net/lists/listinfo/cxx-users |