Properly formatted:

Hi all,

I am a newbie to perl and know nothing of Perl.
I want to embed perl in my C code.I work on Visual Studio in Windows.

The perl code should do something like this.

  1. It should ask for user on command line to input 2 xml files and then it should handover the names of these files to my C code which will do post processing on the contents of these files.
  2. The perl code should also be able to call my C functions based on the number entered on command line by the user.

I have referred the document perlembed.pod and tried to execute the code in section "Maintaining a persistent interpreter" in visual studio C++ environment. But the output is not as expected in the document.The test.pl is never executed.

I will just give a glimpse of what I want to do

#include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl = NULL; int _tmain(int argc, _TCHAR* argv[]) { UInt8 char * arg1,*arg2; //Execute some C code over here. // Allocate a perl interpreter memory and then perl code should wai +t on DOS prompt for user to enter the file names and // these file names would be asssigned to arg1 and arg2.Now My C co +de will do processing on contents of these files. // And also I should be able to call some C functions from a perl s +cript code.something like this number = perlgetnumber();// Number pressed by the user. //Call some Functions based on the number. // Deallocate the perl interpretr memory and quit. }

Can anybody in the group give me Embedded (C and Perl) code.
It will take a lot of effort to learn and do it.

Please guide me.

Thanks in Advance.
Anand

Re "give me Embedded (C and Perl) code" please see http://www.rentacoder.com. This isn't it.

Others have pointed to the Monastery's markup guidelines; you should also see On asking for help and How do I post a question effectively?. Once you have made your own best effort to write the code you seek, post that and the error messages it produces (if any) or a precise description of how it fails to do what you expected. Then, you may expect more specific help.


In reply to Re: Embedding Perl and C by ww
in thread Embedding Perl and C by Bhavikatti

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.