i didn't post code because i don't think it's a problem where one can point at a line and say AHA!
the SWIG module is simply :
sub method {
my @args = @_;
$args[0] = tied(%{$args[0]});
my $result = C++CODE::method(@args);
return $result;
}
and perl grabs the package with
use lib (<path>)
use (C++ package)
as one would expect
my $dsgn = new (c++_object)
$dsgn->(method)
and these lines work IF done in MAIN.
if done in a routine and returned to MAIN;
it dumps core.
the object is a PERL HASH; and the address never changes
when printed out. at first, i thought that meant the object is still present; but the C++ folks say otherwise.
i'm thinking it's a namespace issue. another perl coder
has declared the object as a global OUR. that seems to work
only for the case :
MAIN
my C++object
C++object = pckA::routine
pckB::routine(C++object)
PACKAGEA
our C++object
routine
new C++object
return C++object
PACKAGEB
routine
my $C++object = @_
$C++object->method()
and it ONLY works with OUR!
so why is the OUR declaration required?
is it a PERL problem with swigged objects or is
the C++ code not swig/perl compatable?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.