call pperl from c++ passing token list

C

Charlie

I have a c++ program which contains numerous functions to perform
calculations on a list of tokens. Every time a calculation is
changed/added we need to change the program. I would like to put the
calculation routines in an external files and invoke them from the
program. It appears that perl may be a good fit for this (btw, I am
not a perl programmer).
Does this seem doable (or easy) with perl? Any pointers or tips for
getting started or thigs to look out for?
thanks...charlie
 
B

Ben Morrow

Quoth (e-mail address removed) (Charlie):
I have a c++ program which contains numerous functions to perform
calculations on a list of tokens. Every time a calculation is
changed/added we need to change the program. I would like to put the
calculation routines in an external files and invoke them from the
program. It appears that perl may be a good fit for this (btw, I am
not a perl programmer).
Does this seem doable (or easy) with perl? Any pointers or tips for
getting started or thigs to look out for?

It's certainly doable; I'd say Perl was a good choice, but then I would :).

While you can simply create the calculations a little Perl programs and
feed them to an external perl process, it would (IMHO) be more elegant
and easier to embed perl in your C++ app. This is not that hard: read
the 'perlembed' document that comes with perl (try 'perldoc perlembed'
or 'man perlembed'). You shouldn't have any serious problems if you're
familiar with C/C++.

Ben
 
C

Charlie

I was thinking of imbedding perl ( it had read that could be done) and
have the scripts (calculation routines) as external files so that they
could easily be replaced. I think my biggest problem is changing the
linked list of c++ tokens ( a class) that is passed to the calculation
routines, to a similar perl structure. From what I have read so far,
it appears an array of hash entries would be what I need. I've been
reading and plying with these, but if you have nay other suggestions
I'm open to other's experience.
charlie
 
B

Ben Morrow

Quoth (e-mail address removed) (Charlie):
I was thinking of imbedding perl ( it had read that could be done) and
have the scripts (calculation routines) as external files so that they
could easily be replaced. I think my biggest problem is changing the
linked list of c++ tokens ( a class) that is passed to the calculation
routines, to a similar perl structure. From what I have read so far,
it appears an array of hash entries would be what I need. I've been
reading and plying with these, but if you have nay other suggestions
I'm open to other's experience.

My only suggestion would be to look at Inline::CPP to see if you can use
it to wrap a simple Perl class around your C++ one. I'm not at all sure
how easy it is to get a C++ program to communicate with an Inline::CPP
function in an embedded Perl, but if you're lucky it'll all just work
:).

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top