Someone can tell me how integrate VC++ with perl

L

lala4life

I look for some doc in the network, but didn't find any usefull, i
have experience programing with perl but no with VC++, at least with
this topic.

If someone can tell where can get examples it really nice.
 
M

Mirco Wahab

lala4life said:
I look for some doc in the network, but didn't find any usefull, i
have experience programing with perl but no with VC++, at least with
this topic.

To do what?
If someone can tell where can get examples it really nice.

For what?

"integrating Perl-Code-Modules into a VC++-Programm"
or
"integrating VC++-Code-Modules into a Perl-Programm"?
or something else?

Regards

Mirco
 
L

lala4life

To do what?


For what?

"integrating Perl-Code-Modules into a VC++-Programm"
or
"integrating VC++-Code-Modules into a Perl-Programm"?
or something else?

Regards

Mirco

I need to integrate Perl functionalities into a VC++ program. con you
help me with that?
 
M

Mirco Wahab

lala4life said:
I need to integrate Perl functionalities into a VC++ program. con you
help me with that?

OK, which Version of VC do you have?

Which Perl version do you use?


Regards

M.
 
M

Mirco Wahab

lala4life said:
VC++ 6.0 and perl 5.8.

Good.

Where's your Perl installed to? c:\perl? d:\perl?
(Is it Activestate's Perl distribution?)

Regards

Mirco
 
L

lala4life

I look for some doc in the network, but didn't find any usefull, i
have experience programing with perl but no with VC++, at least with
this topic.
If someone can tell where can get examples it really nice.

I'm not really sure about what you're asking about but someone wrote a
tutorial about a somewhat related topic at Perl Monks:

http://perlmonks.org/index.pl?node_id=583586

Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

this article it to make operative CPAN module in windows XP with
visual studio 2005, that mean
perl -MCPAN -e shell; > install XXX::MODULE
work calling the right compiler for win32, not make command of linux.
 
M

marora

Good.

Where's your Perl installed to? c:\perl? d:\perl?
(Is it Activestate's Perl distribution?)

Regards

Mirco

Can you breifly describe the problem you are trying to resolve?

Just by reading your posting, I can't fathom, if you are interested
to run perl scripts from a C++ program or the otherway around!

Regards,
Manish
 
L

lala4life

Good.

Where's your Perl installed to? c:\perl? d:\perl?
(Is it Activestate's Perl distribution?)

Regards

Mirco

yeap your right i have a activestate distribution , under c:\perl
 
L

lala4life

Can you breifly describe the problem you are trying to resolve?

Just by reading your posting, I can't fathom, if you are interested
to run perl scripts from a C++ program or the otherway around!

Regards,
Manish

i have an aplication that send me data to my web site, there is
processing. nothing unsual.
well i made some perl script that do the job in "shedule task" over a
win32 server, but that mean have a perl interpreter installed on
server (my client doesn't like that)

So i think, if i can call a perl interpreter or an instance of perl
or pack this script within VC++ program, that solve my problem after
all Perl is c program. I don´t know if this is possible over win32 or
was that yet another dream induced by late night pizza.
 
L

lala4life

Can you breifly describe the problem you are trying to resolve?

Just by reading your posting, I can't fathom, if you are interested
to run perl scripts from a C++ program or the otherway around!

Regards,
Manish

Well, i need to do some post process to send data to my web site, over
win32, usually call the perl script with "Schedule Task" but that mean
have a distribution of perl installed on the server, my client doen't
like the idea.

I don't know if is possible pack perl functionality or call ans
instance of perl within a VC++ program or was that yet another dream
induced by late night pizza.
 
M

Mirco Wahab

lala4life said:
yeap your right i have a activestate distribution , under c:\perl

Then you could do the following:
1) Start Visual C++, open your project
2) in
[Tools]->Options->|Directories|
choose "Include Files" (Show Directories for ...)
and add
C:\Perl\lib\CORE
in the empty line below the other lines
3) in
[Tools]->Options->|Directories|
choose "Library Files" (Show Directories for ...)
and add
C:\Perl\lib\CORE
in the empty line below the other lines
4)in
[Project]->Settings->|Link|
choose Category "General"
and find the line "Object/Library modules"
at the end of the stuff add (delimited by space): perl58.lib
press ok

Then save all your project settings. You are now
able to inlucde the Perl-interpreter into your
program.

Now write the following code (for testing):

...
#include <stdio.h>

#include <EXTERN.h>
#include <perl.h>
...

PerlInterpreter *my_perl;
static char *embedding[] = { "", "-e", "0" };

int main(int argc, char **argv, char **envp)
{
int i;
SV * s_pre;

PERL_SYS_INIT3( &argc, &argv, &envp );
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, 0, 3, embedding, envp);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);


rbuffer = new char [64000];

// write some program arguments to Perl (see what happens)
for(i=1; i<argc; i++) {
sprintf(rbuffer,"push @ARGV,'%s';", argv);
s_pre = eval_pv( rbuffer, TRUE );
}

perl_destruct( my_perl );
perl_free ( my_perl );
PERL_SYS_TERM();

return 0;
}

If that compiles and runs, you are through.

Next step:

Write sime Perl programs "in place", like

const char someprogram[] =
{
" print \"Perl loaded o.k.\"; \n"
" print \" <== \", Perl $] on $^O \"\\n\"; \n"
"1;"
};

and invoke by:

...
s_pre = eval_pv( someprogram, TRUE );
if( SvIV(s_pre) != 1 ) {
perror("test prog didn't execute\n");
exit(-1);
}
...

or load another perl source file (do ...) from there.

But one step after the other ;-)

Regards

M.
 
M

Mirco Wahab

Mirco said:
" print \" <== \", Perl $] on $^O \"\\n\"; \n"
^
| There's a ""-group missing
or in the wrong place, correct:

...
" print \" <== Perl $] on $^O \\n\"; \n"
...


Sorry,

M.
 
S

Sisyphus

lala4life said:
I look for some doc in the network, but didn't find any usefull, i
have experience programing with perl but no with VC++, at least with
this topic.

If someone can tell where can get examples it really nice.

See 'perldoc perlembed'.

Cheers,
Rob
 
S

Sisyphus

..
..
i have an aplication that send me data to my web site, there is
processing. nothing unsual.
well i made some perl script that do the job in "shedule task" over a
win32 server, but that mean have a perl interpreter installed on
server (my client doesn't like that)

----------------------------------

Another option is to compile your perl script into a stand-alone executable
(using the PAR module's pp utility).

Cheers,
Rob
 
S

Sherm Pendley

Mirco Wahab said:
Good.

Where's your Perl installed to? c:\perl? d:\perl?
(Is it Activestate's Perl distribution?)

Ever feel like a prosecutor trying to question a hostile witness? :)

sherm--
 
M

Mirco Wahab

Sherm said:
Ever feel like a prosecutor trying to question a hostile witness? :)

Oh!

No, if he'd be "hostile", we'd give him a soft chair,
are very very friendly, smile, give him coffee and
approach him as "Lieber Herr Fachmann¹" ...

Regards

M.



¹ "Dear Mr. Expert"
 
L

lala4life

yeap your right i have a activestate distribution , under c:\perl

Then you could do the following:
1) Start Visual C++, open your project
2) in
[Tools]->Options->|Directories|
choose "Include Files" (Show Directories for ...)
and add
C:\Perl\lib\CORE
in the empty line below the other lines
3) in
[Tools]->Options->|Directories|
choose "Library Files" (Show Directories for ...)
and add
C:\Perl\lib\CORE
in the empty line below the other lines
4)in
[Project]->Settings->|Link|
choose Category "General"
and find the line "Object/Library modules"
at the end of the stuff add (delimited by space): perl58.lib
press ok

Then save all your project settings. You are now
able to inlucde the Perl-interpreter into your
program.

Now write the following code (for testing):

...
#include <stdio.h>

#include <EXTERN.h>
#include <perl.h>
...

PerlInterpreter *my_perl;
static char *embedding[] = { "", "-e", "0" };

int main(int argc, char **argv, char **envp)
{
int i;
SV * s_pre;

PERL_SYS_INIT3( &argc, &argv, &envp );
my_perl = perl_alloc();
perl_construct( my_perl );
perl_parse(my_perl, 0, 3, embedding, envp);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_run(my_perl);

rbuffer = new char [64000];

// write some program arguments to Perl (see what happens)
for(i=1; i<argc; i++) {
sprintf(rbuffer,"push @ARGV,'%s';", argv);
s_pre = eval_pv( rbuffer, TRUE );
}

perl_destruct( my_perl );
perl_free ( my_perl );
PERL_SYS_TERM();

return 0;
}

If that compiles and runs, you are through.

Next step:

Write sime Perl programs "in place", like

const char someprogram[] =
{
" print \"Perl loaded o.k.\"; \n"
" print \" <== \", Perl $] on $^O \"\\n\"; \n"
"1;"

};

and invoke by:

...
s_pre = eval_pv( someprogram, TRUE );
if( SvIV(s_pre) != 1 ) {
perror("test prog didn't execute\n");
exit(-1);
}
...

or load another perl source file (do ...) from there.

But one step after the other ;-)

Regards

M.


Thanks
 
J

John W. Krahn

Mirco said:
Oh!

No, if he'd be "hostile", we'd give him a soft chair,
are very very friendly, smile, give him coffee and
approach him as "Lieber Herr Fachmann¹" ...

OH NO ... not the soft chair!



John
 
J

Josef Moellers

John said:
Mirco Wahab wrote:


OH NO ... not the soft chair!

Noooooo, ............. the .... comfy chair!

Hah! You didn't expect the spanish inquisition!
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top