By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,110 Members | 1,010 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,110 IT Pros & Developers. It's quick & easy.

problem including perl header files

P: n/a
hiii all

I'm tryin to call a perl script from a C program in following 2 ways-

1.By callin system function.
But there's some problem because the system function is not able to
executeany command...it just returns -1.

2.By using the code given in perldoc perlembed(perl documentation for
embedding perl in C)
the code looks like this-
#include <EXTERN.h> /* from the Perl distribution
*/
#include <perl.h> /* from the Perl distribution
*/

static PerlInterpreter *my_perl; /*** The Perl interpreter
***/

int main(int argc, char **argv, char **env)
{
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
}
now wat happens is that it gives error tht it does not recognise perl.h
and extern.h
copying them to Turbo C's include folder doesn help cos then it
compiles these files also n gives 26 errors!!it is also unable to
locate the header files tht these files use.
Is there any way for me to specify in Turbo C,two paths to look for wen
searching for header files.
in options>directories>include directories i gave a comma n gave path
for perl header files..but it doesn work!!!

Pleeeease help...m at the end of my ideas now!
Thanx in advance.
shruti

May 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
shruti wrote:
hiii all

I'm tryin to call a perl script from a C program in following 2 ways-

1.By callin system function.
But there's some problem because the system function is not able to
executeany command...it just returns -1.
Using the system command is the only method provided by the C standard.
However, you've not provided the code for that so we can't comment on
what you might have done wrong.
2.By using the code given in perldoc perlembed(perl documentation for
embedding perl in C)
the code looks like this-
#include <EXTERN.h> /* from the Perl distribution
*/
#include <perl.h> /* from the Perl distribution
*/
<snip>

This is nothing to do with standard C, if you want to know how to embed
Perl ask in a Perl group or mailing list.
now wat happens is that it gives error tht it does not recognise perl.h
and extern.h
That is almost always the wrong thing to do.
copying them to Turbo C's include folder doesn help cos then it
compiles these files also n gives 26 errors!!it is also unable to
locate the header files tht these files use.
Is there any way for me to specify in Turbo C,two paths to look for wen
searching for header files.
in options>directories>include directories i gave a comma n gave path
for perl header files..but it doesn work!!!


I'm sure there is a method, although whether you can call a modern build
of Perl with such an ancient compiler is another matter. For how to use
Turbo C either read the documentation or ask in a Boreland group.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
May 15 '06 #2

P: n/a
"shruti" <sh************@gmail.com> writes:
I'm tryin to call a perl script from a C program in following 2 ways-

1.By callin system function.
But there's some problem because the system function is not able to
executeany command...it just returns -1.
Then you're doing it wrong. Without seeing what your call to system()
looks like, we can't possibly guess *what* you're doing wrong.
2.By using the code given in perldoc perlembed(perl documentation for
embedding perl in C)
the code looks like this- [snip] now wat happens is that it gives error tht it does not recognise perl.h
and extern.h
copying them to Turbo C's include folder doesn help cos then it
compiles these files also n gives 26 errors!!it is also unable to
locate the header files tht these files use.
Copying header files is almost certainly not what you want to do.

You need to tell your compiler where to find the existing header
files. Once you figure out how to do that, you'll also need to tell
your compiler and/or linker where to find the libraries.
Is there any way for me to specify in Turbo C,two paths to look for wen
searching for header files.
in options>directories>include directories i gave a comma n gave path
for perl header files..but it doesn work!!!


There probably is a way to do that. I have no idea what it is. It's
a question about Turbo C, not about the C programming language. I
presume Turbo C includes documentation. If not, find a forum
(newsgroup, web site, mailing list, whatever) that discusses Turbo C.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.