c/python embedding

Shaun Hogan shogan at iel.ie
Tue Mar 7 15:37:30 CET 2000



below is the c file 'tester.c', what im trying to do is:
write python script that does the equivalent to the following : i.e., creates the C++ object created in this function (the "writeThisInPython" function) and then calls the same 2 methods called here, i.e., getName() and getNumber().

if anyone has any ideas on how i can figure out how TODO these 2 problems, could they please let me know.
thanks
Shaun

/*----------------------
tester.c
----------------------*/

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

void writeThisInPython(void);
void callPythonFromHere(void);

void main(void)
{
 writeThisInPython();
 callPythonFromHere();
}

// TO-DO 1 : write python script that does the equivalent to the following :
// i.e., creates the C++ object created in this function and then calls
// the same 2 methods called here, i.e., getName() and getNumber()

void writeThisInPython(void)
{
 Subscriber subscriber("Mick McCarthy", 99);

 cout << "Subscriber Name   : " << subscriber.getName() << endl;
 cout << "Subscriber Number : " << subscriber.getNumber() << endl;
}

void callPythonFromHere(void)
{
 Subscriber subscriber("Mick McCarthy", 99);

 cout << "Subscriber Name   : " << subscriber.getName() << endl;
 cout << "Subscriber Number : " << subscriber.getNumber() << endl;

 // TO-DO 2 : call python code from here to write the above details
 // to a file (format doesn't matter)
}

----------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000307/3cf057a6/attachment.html>


More information about the Python-list mailing list