-3

Possible Duplicate:
Calling C/C++ from python?

I am looking to bridge a C++ and python code.

The interfaces needed by python code are :

floatvect(): this one should return an empty float vector (basically a list)

get_quant(input_list_2, self.m_state_num, self.m_qm_vector)

The corresponding C++ function is :

int equalwidth_quant(int target_num_state, FloatVec &raw_data, FloatVec &init_quant)

When my python code contacts get_quant, it should be able to call the corresponding C++ function and get the result. The result is basically stored in the last attribute of that C++ function.

Is there any specific libraries which I can use for achieving this?

Community
  • 1
  • 1
sethu
  • 1,691
  • 4
  • 22
  • 34

1 Answers1

1

You need to write equalwidth_quant as a C-extension for Python. Check out Cython or here's a simple tutorial.

Jacob
  • 34,255
  • 14
  • 110
  • 165