develooper Front page | perl.perl5.porters | Postings from February 2015

perlapi: hash containing a hash

Thread Next
From:
JR Heisey
Date:
February 5, 2015 11:04
Subject:
perlapi: hash containing a hash
Message ID:
F3B2BD13EFC1A74DB0150120638876EF46360024@USW-MAIL1.synaptics-inc.local
Greetings,

I am new to this mail list so please forgive my transgressions. :)
I do not know where else to ask this question.

Question:
I want to use the perlapi to perform this equivalent hash lookup to retrieve a scalar value.

$simVariableDefns{"promdata"}->{fixedSize};

So far I have come up with:

  SV ** svp ;
  HV * hvVar = perl_get_hv("simVariableDefns",FALSE);
  if ((svp = hv_fetch(hvVar, "promdata", 8, FALSE)))
  {
// How do I convert a SV * to a HV * and is that what I need to do?
//    HV * hvProm =
    //if ((svp = hv_fetch(hv, "fixedSize", 9, FALSE)))
    //{
    //  error = eSimt4ApiError_Success;
    //}
// not correct
    m_uArg1 = SvIV(*svp);
  }

Background:
I have a standalone perl application which I am porting to a library which will run as a background thread.
I am running the perl engine in the background thread using perl_alloc(), etc.

I have my own API functions with which to interact with the perl application.
The above C code snippet is part of the implementation of my API.

My alternative is to create a Perl function to perform the hash lookup and call that function from C.

Thanks,
Regards
J.R. Heisey                            Synaptics, Inc.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About