Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi monks,
I am using perlembed for calling perl subroutines from C . I need to pass huge files (around 1Mb) from C to perl. The files are stored in character buffers .char *htmFile .The "htmFile" variable holds the entire file content.

I use "call_pv" for calling perl subroutines from C after pushing the arguments onto perl stack using "xPUSHs". I want to know is there any way by which i could pass the char pointer to perl and use it as a reference in perl. I cannot pass the entire buffer using XPUSHs(sv_2mortal(newSVpvn(htmFile)))
as the perl stack is creating problems(SEG fault) when the file size is around 64kb.What could be the possible reason for this?. Could any of the esteemed monks tell me an efficient manner to pass the huge file to perl? (ofcourse without storing it in harddisk in C and accesing from perl)

Thanks,
Kiran.

In reply to converting a C pointer to a perl reference by jithoosin

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found