Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I can do this:calculate('V_MIN',4.5);
I've looked at perlxs, but haven't found a way to do this. I want to be anle to get the values from the passed-in hash for keys "NAME" and "THETA". Here's my best quess thus far:calculate(NAME => 'V_MIN', THETA => 4.5);
...but it won't even compile. I get errors:int calculate(hash) HV * hash; CODE: char * name; float theta; name = (char *)hv_fetch(hash,"NAME",4,0); theta = hv_fetch(hash,"THETA",5,0); printf("%s,%.1f\n",name,theta); . . . RETVAL = 1; OUTPUT: RETVAL
Can anyone help?ChemC.xs: In function `XS_ChemC_calculate': ChemC.xs:122: parse error before `char' ChemC.xs:125: `name' undeclared (first use in this function) ChemC.xs:125: (Each undeclared identifier is reported only once ChemC.xs:125: for each function it appears in.) ChemC.xs:126: `theta' undeclared (first use in this function) make: *** [ChemC.o] Error 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XS hash question
by Anonymous Monk on May 24, 2001 at 08:01 UTC | |
|
(tye)Re: XS hash question
by tye (Sage) on May 24, 2001 at 22:21 UTC | |
|
Re: XS hash question
by robsv (Curate) on May 25, 2001 at 03:27 UTC |