'Can i access c++ or Java functions inside python [duplicate]

I am mainly using python for extensive algorithms operations. Now i have my webiste in Django.

I few libraries in c++ and few in Java which i don't have in python. Or you can say that i already have some c++ , Java files in which some algorithm is coded.

can i call those function or do some calculation in my djnago sites using those c++ or java files



Solution 1:[1]

For C++, certainly. Either write a module that wraps the library, or use something like ctypes or SWIG.

For Java, you'd be best to move to Jython (and correspondingly use django-jython).

Note that using both C++ and Java from Python is not trivial.

Solution 2:[2]

I've used Boost.Python to some degree of success for accessing C++ libraries within Python/Django.

Solution 3:[3]

You could check the http://www.scipy.org/Weave weave package for C/C++. I didn't use it myself, but I know it exists

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ignacio Vazquez-Abrams
Solution 2 Steve Walsh
Solution 3