//Liquidx.cpp:Defines The entry point for the console application.
//
#include "stdafx.h"
#in Clude <boost/python/def.hpp>
#include <boost/python/module.hpp>
#include <boost/python/ Args.hpp>
#include <boost/python/class.hpp>
#include <boost/python/str.hpp>
#include < Boost/python/dict.hpp>
#include <iostream>
#include <string>
#include <list>
# Include <map>
using namespace std;
Pyobject * repeatstring (pyobject *pself, Pyobject *pparams)
{
char *pstrstring;
int irepcount;
Pyarg_parsetuple (pparams, "Si", &pstrstring, &irepcount);
for (int i = 0; i < irepcount i++) printf ("---%d\n", i);
return Pyint_fromlong (Irepcount);
}
int _tmain (int argc, _tchar* argv[])
{
py_initialize ();
Py_isinitialized ();
Pyimport_addmodule ("Hostapi");
//create a function table
Pymethoddef HostApifuncs [] =
{
{"repeatstring", repeatstring, Meth_varargs, null},
{null, NULL, NULL, NULL}
};
//initial the module with the function table
Py_initmodule ("Hostapi", Hostapifuncs);
Pyobject *pname = pystring_fromstring ("HelloWorld");
Pyobject * pmodule = Pyimport_import (pname);
Pyobject *pstr= null, *pdict= null;
//get the module dict
pdict = pymodule_getdict (pmodule);
Pstr = pydict_getitemstring (pdict, "Printstuff")//get the function with the Dict
Pyobject_callobject (pstr, NUL L); Call the function
Pyobject *pfunc = pydict_getitemstring (pdict, "Repcount");
int as = Pyint_as_long (P FUNC);
printf ("**************************%d", as);
//py_xdecref (pfunc);
Py_xdecref (PSTR);
//py_xdecref (pdict);
Py_xdecref (Pmodule);
Py_xdecref (pname);
Py_finalize ();//Clear
GetChar ();
return 0;
}