Reinhard Pagitsch <[EMAIL PROTECTED]> writes: >> >Thank you for your informations, it seems to me I have to do the same >way. The most interesting things to me is where perl stores >XS _return_ values and how to capture it from the .pm module.
XS return values go on the stack in the same way that normal perl sub returns do. So to return a hash in perl one can write sub hash_by_ref { my %hash; ... return \%hash; # XS - RV to the HV } my $ref = hash_by_ref(); if (exists $ref->{Key}) ... Or sub hash_as_list { my %hash; ... return %hash; # XS nothing automatic looks like next } my %hash = hash_as_list(); if (exists $hash{Key}) ... or sub hash_as_pairs { return (Key => $value, Another => undef, Answer => 42); # XS PPCODE pushing alternate key/value SVs } my %hash = hash_as_pairs(); if (exists $hash{Key}) ... >e.g: I have a XS function which shall return a hash to my .pm. I >saw in the module from Glen Small (Win32::PerfMon) that there >will be passed a variable to the XS function which holds error message >if any. But the function it self does not return the performance data >of a process, but it worked I can capture specific data from a added >performance counter. So I am very confused how the .pm >method know the data captured by the XS function. > >I wrote a XS module which capture all running win32 processes and put >them back in a hash, I belived. But in real it was an >Array containing the hash with the names and PID's. >May I send you my XS source and than you would be so kind to explain my >code and tell me all necessary improvements? If you post the XS function I/we can comment it for you - but suggest you don't post 1000s of lines ;-) >(I plan to upload it to CPAN) > >mit freundlichen GrÃÃen, >with my best regards, >Reinhard