By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,373 Members | 1,984 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,373 IT Pros & Developers. It's quick & easy.

how to pass object reference between Perl XS and Perl ?

P: 3
I have a class A that is defined in xs


Expand|Select|Wrap|Line Numbers
  1. class A{
  2.    A() { a = 100;};
  3.    int a;
  4. };
I create an object of this class from perl

Expand|Select|Wrap|Line Numbers
  1. package->new();
and save this pointer in perl class.

and I also wrote a perl function that return this pointer

Expand|Select|Wrap|Line Numbers
  1. my($self) = @;
  2. return \$self->[CPPSPLITOBJECT];
I also wrote XS function to get this object:

Expand|Select|Wrap|Line Numbers
  1. SV* chunk = newSV(0);
  2. call_GetCppObject(currentObject, chunk)
  3. CppSplitSeqClass* cppObject = (CppSplitClass*)chunk;
and now if a check the value of "a" it will not be correct

Expand|Select|Wrap|Line Numbers
  1. cppObject->a;
But all function can be called ok.
What can be wrong here?
Jun 30 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.