#!/usr/bin/perl

use PDL;
#my $path = '/data/ingo/share/sequence/VB17/ice_nav/ShiftVector/';
use Inline Pdlpp => Config =>
	NOISY=>1,
	AUTO_INCLUDE => <<"EOC"
EOC
	,
	OPTIMIZE=>'-fPIC -O2',
	;

#use Inline Pdlpp => 'DATA', structs => ['TrackerWrapper'];

use Inline qw/Pdlpp/;
use 5.10.0;
use PDL::NiceSlice;
use strict;
use warnings;


sub set_image {
    my $piddle = shift;
    my $p;
    $$p=10;
    say "beore p $p content ".$$p;
    $piddle->set_image($$p);
    say "after p $p content ".$$p;
}

my $data=rvals(128,128,10);
set_image($data(,,0));
# gplot (with=>'image',$data);
my $mat;


#($shifts,$basis,);
__DATA__



__Pdlpp__
pp_def ('set_image',
	Pars=>'m(k,l);',
	OtherPars=>'IV p;',
	Code=>pp_line_numbers(__LINE__,
	'
		PDL_Indx * vp = & $COMP(p);
		printf ("vp %d.\n",vp);
		printf("*vp %d\n",(*vp));
		int i = 42;
		(*vp) = &i;
		//vp = & i;
		(*vp) =  i;
		printf ("vp %d.\n",vp);
		printf("*vp %d\n",(*vp));
	'),
	);

