Good or bad, I want to be able to share a double with C and Perl. The complicated part is that I need to be able to take the address of the double in C (as a global) and use it through various functions. i.e.
double *globalvar;
void setvar (double *var) { globalvar=var; }
void process1 (double value) { *globalvar=value; }
void show (void) { printf ("XS: Var is now %f\n",*globalvar); }
And in perl:
$a=0;
setvar($a);
printf ("Perl: Var is initially $var\n";
process1(5);
printf ("Perl: Var is now $var\n";
$a=10;
show();
----
The result should be
Perl: Var is initially 0 Perl: Var is now 5 XS: Var is now 10.000000
---
Is this possible somehow? Can I get the address of the perl variable (I am thinking I need to use a reference somehow)
Thanks for any and all advice! Tim