Patrick Dupre wrote:
> I am trying to explain,
>
> Here are the 2 perl subroutines:
> sub sub1 {
>my %a ;
>$a {a} = 1 ;
>$a {b} = 2 ;
>foreach (keys %a) {
> print $_, " => ", $a {$_}, "\n" ;
> }
>return \%a ;
>}
>
> sub sub2 {
>my ($h) = @_ ;
>foreach (ke
I am trying to explain,
Here are the 2 perl subroutines:
sub sub1 {
my %a ;
$a {a} = 1 ;
$a {b} = 2 ;
foreach (keys %a) {
print $_, " => ", $a {$_}, "\n" ;
}
return \%a ;
}
sub sub2 {
my ($h) = @_ ;
foreach (keys %$h) {
print $_, " => ", $$h {$_}, "\n" ;
}
}
+++
Patrick Dupre wrote:
> Rob Dixon wrote:
>>
>> It would be nice to have been told the symptoms you are getting, as your code
>> looks basically correct.
>>
>> All I can see that is wrong is that you need to add PUSHMARK(SP) before the
>> call to the Perl subroutine to mark the end of any parameter
Hello Rob,
I am trying to investigate more, but, one problem seems to that that the
SvTYPE (ret) is 3, ie that it is a RV reference when it should be a
hash reference. Am I correct ?
Patrick Dupre wrote:
I am desesperated !
Assuming the following perl sub:
sub sub1 {
my %a ;
$a {a} = 1
Patrick Dupre wrote:
>
> I am desesperated !
>
> Assuming the following perl sub:
> sub sub1 {
>my %a ;
>$a {a} = 1 ;
>$a {b} = 2 ;
>foreach (keys %a) {
> print $_, " => ", $a {$_}, "\n" ;
> }
>return \%a ;
>}
>
> Using XS, I am tring to get the hash using:
>
I am desesperated !
Assuming the following perl sub:
sub sub1 {
my %a ;
$a {a} = 1 ;
$a {b} = 2 ;
foreach (keys %a) {
print $_, " => ", $a {$_}, "\n" ;
}
return \%a ;
}
Using XS, I am tring to get the hash using:
PREINIT:
int count ;
SV *ret ;
HV *ptr ;
SV *