#include <iostream>
#include "Python.h"

int main(int argc, char *argv[])
{
	PyObject *pModule, *pDict, *pClass, *pNetwork, *pInstance, *pValue;
	char *cstring;

	Py_Initialize();
	PyRun_SimpleString("import sys\n"
			"print sys.version");
	pModule = PyImport_ImportModule("clamrefactor");
	if (pModule == NULL)
	{
		PyErr_Print();
	        return 1;
	}
	pDict = PyModule_GetDict(pModule);

	// Build the name of a callable class 
	pClass = PyDict_GetItemString(pDict, "ClamNetwork");

	// Create an instance of the class
	if (PyCallable_Check(pClass))
	{
		pNetwork = Py_BuildValue("(s)", "test.clamnetwork");
		pInstance = PyObject_CallObject(pClass, pNetwork); 
	}
	if (pInstance == NULL)
	{
		PyErr_Print();
	}
/*	pValue = PyObject_CallMethod(pInstance, "dump", NULL);

	if (pValue != NULL)
	{
		PyArg_Parse(pValue, "s", &cstring);
		printf("Return of call : %s\n", cstring);
		Py_DECREF(pValue);
	}
	else
	{
		std::cout << "It's NULL!!" << std::endl;
		PyErr_Print();
	}
*/
	// Clean up
	Py_DECREF(pModule);
	Py_DECREF(pNetwork);
	Py_Finalize();

	return 0;
}
