Philip M. Gollucci
2006-11-11 10:08:29 UTC
Before tackling a larger project, I am trying to get a little demo C++
fraction class (attached) bound with XS.
It compiles properly but fails make test with a
make: *** [test_dynamic] Segmentation fault
The problem seems to be passing the result of the fract::operator+
function back to Perl.
Thanks for any help!
#line 76 "Fract.xs"fraction class (attached) bound with XS.
It compiles properly but fails make test with a
make: *** [test_dynamic] Segmentation fault
The problem seems to be passing the result of the fract::operator+
function back to Perl.
Thanks for any help!
// fract *ptr1,*ptr2,*ptr;
// ptr=new fract;
RETVAL->operator=(*THIS+*other);
RETVAL is not yet initialized yet its simply a pointer if you look at
the Fract.c file.
diff Fract.xs Fract.xs.new
--- Fract.xs Sat Nov 11 02:08:04 2006
+++ Fract.xs.new Sat Nov 11 02:08:00 2006
@@ -75,6 +75,7 @@
CODE:
// fract *ptr1,*ptr2,*ptr;
// ptr=new fract;
+ RETVAL = new fract();
RETVAL->operator=(*THIS+*other);
cerr << "RetVal calculated...\n";
// RETVAL=Data_Wrap_Struct(cFract,0,fract::free,ptr);
HTH
--
------------------------------------------------------------------------
Philip M. Gollucci (***@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F 6A47 D55A 7172 A799 97F
I never had a dream come true
'Til the day that I found you.
Even though I pretend that I've moved on
You'll always be my baby.
I never found the words to say
You're the one I think about each day
And I know no matter where life takes me to
A part of me will always be...
A part of me will always be with you.