CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
Call perl script subroutine from C++

 



sach_1979
Novice

Jun 18, 2009, 11:08 PM

Post #1 of 4 (5775 views)
Call perl script subroutine from C++ Can't Post

Hi all,

I am trying to access perl sub routin from C++ application. I am getting linker error

error LNK2019: unresolved external symbol _Perl_call_pv referenced in function "void __cdecl showtheTime(void)" (?showtheTime@@YAXXZ)

error LNK2019: unresolved external symbol _Perl_markstack_grow referenced in function "void __cdecl showtheTime(void)" (?showtheTime@@YAXXZ)


My perl script is very simple

sub showtime {
print time;
}

and my C++ file I am calling this subroutin using call_pv.

C++ code looks like:

#include
"EXTERN.h"

#include
"perl.h"

static
PerlInterpreter *my_perl;

void
showtheTime()

{

dSP;

PUSHMARK(SP);

call_pv(
" showtime", G_DISCARD | G_NOARGS);

}


void
main()

{

showtheTime();

}

Where am I going wrong here?



Thanks

Sachin



FishMonger
Veteran / Moderator

Jun 19, 2009, 5:02 AM

Post #2 of 4 (5771 views)
Re: [sach_1979] Call perl script subroutine from C++ [In reply to] Can't Post

You should ask C++ questions in one of the C++ forums.


sach_1979
Novice

Jun 19, 2009, 5:31 AM

Post #3 of 4 (5768 views)
Re: [FishMonger] Call perl script subroutine from C++ [In reply to] Can't Post

Hi,

I am extreamly sorry for that.

My question was which all libraries of perl are required for calling Perl subroutine from C/C++?

As I mentioned, I am getting linking errors which means that the perl calls are not finding definitions. So, please let me know hwich all libraries needs to be included.



Thanks

Sachin


FishMonger
Veteran / Moderator

Jun 19, 2009, 5:42 AM

Post #4 of 4 (5765 views)
Re: [sach_1979] Call perl script subroutine from C++ [In reply to] Can't Post

You need to install perl and have your C++ program execute the Perl script and capture its output.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives