On Wed, 30 Jul 2008, Rob Dixon wrote:

Patrick Dupre wrote:

Inside a c routine (ie. inside a .c file) is there any way to define a
variable of type SV (or SV *) ?
From xs, it is no problem.

Yes. You can say

 SV *var = &PL_sv_undef;
Where should I say it ?

What I want, by using a c routine in a .c file (not .xs) is to return a
value to perl without using RETVAL (I need to return 2 values).

This c routine is defined as extern

In c I would do:

test (&a, &b) ; (in perl I could lie to do something like: test ($a, $b) )

with (in .h):
int test (int*, int*) ;

and in .c:

int test (int* t1, int *t2) {
  *t1++ ;
  *t2++ ;
  return (*t1, *t2) ;
  }

This is just a template.


which creates an undefined scalar. But what do you want to do with it?

Rob


--
---
==========================================================================
 Patrick DUPRÉ                      |   |
 Department of Chemistry            |   |    Phone: (44)-(0)-1904-434384
 The University of York             |   |    Fax:   (44)-(0)-1904-432516
 Heslington                         |   |
 York YO10 5DD  United Kingdom      |   |    email: [EMAIL PROTECTED]
==========================================================================
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/

Reply via email to