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

perlapi: hash containing a hash

Thread Next
JR Heisey
February 5, 2015 11:04
perlapi: hash containing a hash
Message ID:

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

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


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);

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.

J.R. Heisey                            Synaptics, Inc.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About