0

trying to use pycxx.

using: python 3.5 64-bit, windows 7 64-bit, pycxx 6.2.8

have written a simple cxx file to test out.

but the build had error, tried to search the solution but failed

aaa.cxx as:

#include "CXX/Objects.hxx"

Py::List haha(Py::List a)
{
    a.append(Py::Long(100));
    return a;
}

setup.py as:

import os, sys
from distutils.core import setup, Extension

support_dir = os.path.normpath(
                   os.path.join(
            sys.prefix,
            'share',
            'python%d.%d' % (sys.version_info[0],sys.version_info[1]),
            'CXX') )

if os.name == 'posix':
    CXX_libraries = ['stdc++','m']
else:
    CXX_libraries = []

setup (name = 'aaa',
       ext_modules = [
         Extension('CXX.aaa',
                   sources = ['aaa.cxx',
                         os.path.join(support_dir,'cxxsupport.cxx'),
                         os.path.join(support_dir,'cxx_extensions.cxx'),
                         os.path.join(support_dir,'IndirectPythonInterface.cxx'),
                         os.path.join(support_dir,'cxxextensions.c')
                         ],
            )
       ]
)

using "python setup.py install" to build, but with error: build error

thank you very much for the help in advance.

  • Do you have function `extern "C" EXPORT_SYMBOL PyObject *PyInit_aaa()` in file `aaa.cxx`? – J.J. Hakala Jul 10 '16 at 06:34
  • Thanks for the reply. No, I do not have that function. The code I showed is all have in that file. I am new to pycxx, just tried to modify the demo in the pycxx package to try out an easy example. Also tried searching the tutorial for pycxx, but no article really shows details how to use it. Thanks again. – datalearning Jul 10 '16 at 08:48
  • I recommend that you read the examples that are part of teh PyCXX kit. Have a look at Demo/Python3/simple.cxx. If that does not help ask on the pycxx mailing list for help. – Barry Scott Jul 18 '16 at 16:51

0 Answers0