Tamar Shinar <[EMAIL PROTECTED]> writes:
>> I am trying to write an xs interface to an external library.
>> My code takes two perl arrays, allocates and populates
>> corresponding C structures, and passes them to the library routine.
>> The problem is that the program is unstable. It will sometimes
>> cause core dumps in the external library. The library in itself
>> is believed to be stable, so it seems to be something in the
>> perl/C interface.
>
>Here is more of the code. see Classify(rvAnimals, rvPlants, count) below:
>
>thanks,
>Tamar
>
>_________________________________________________________
>
>void
>setDouble(HV * hv, char * fieldName, double val)
>{
> SV ** sv = hv_fetch(hv, fieldName, strlen(fieldName), FALSE);
That FALSE (called in L-value context) should propbably be a TRUE
in this case - as you blindly store into returned SV (without testing
if there is one), and don't do an hv_store() yourself.
> if(!SvOK(*sv)) {
> printf("Error - hv_fetch %s returned bad sv\n", fieldName);
> }
> sv_setnv(*sv, val);
>}
>
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/