Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
In XS:

Given an address in memory, is it possible to reconstruct an RV if you know exactly what it looks like (but none of the values)? The particular case that I am most interested in is a very simple reference to a reference, like so:

SV = RV(0x1f6394) at 0x31d968 REFCNT = 2 FLAGS = (ROK) RV = 0x2dfea0
The routine that will be reconstructing the RV will not know the values of the RV's (i.e., 0x1f6394 and 0x2dfea0 in the above example). Unfortunately, the pointer (say, ptr=0x31d968) is typecast to (char *), so if I simply look at sv_dump(*(SV **)ptr), I get something like:
SV = UNKNOWN(0x31) (0x0) at 0x31d968 REFCNT = 0 FLAGS = ()
Am I asking for the moon? I looked at perlapi and perlguts but couldn't quite figure it out. Apparently I don't know enough C tricks to pull this off. So, help me! Any help is appreciated.

In reply to Reconstructing an (SV *) when you know the address and the precise structure of the said SV by asarih

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 making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 19:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found