|
Perl/C++ -shadow adds extra ::<class> to namespace?: msg#00124programming.swig
Hello, I am completely new to SWIG and have already gotten perl it to drive a C++ class perfectly, except for one thing: Shadow classes seem to be adding an extra and undocumented "::<class>" in the perl5 namespace. More precisely, the Vector example in the latest (acroread) docs (Chap. 8 "gory details...") doesn't work as advertised if I am reading things correctly. As reminder: %module vector %{ #include "vector.h" %} struct Vector { double x,y,z; Vector(double _x, double _y, double _z); ~Vector() {}; void addto(Vector *v); }; with "-perl5 -c++ -shadow" is supposed to produce a perl module which you can invoke like this: #!/usr/bin/perl use vector; # Perl code using Vector class $v = new Vector(2,3,4); $w = Vector->new(1,2,3); but instead I must do: #!/usr/bin/perl use vector; # Perl code using Vector class $v = new vector::Vector(2,3,4); # not just "new Vector(2,3,4)" $w = vector::Vector->new(1,2,3); # not just "Vector->new(1,2,4)" In a debugger here's what you get if you try the documented method > DB<1> $v = new Vector(2,3,4) > Can't locate object method "new" via package "Vector" (perhaps you forgot > to load "Vector"?) at (eval 7)[/usr/lib/perl5/5.6.1/perl5db.pl:1521] line 2. and here if you try lc > DB<1> $v = new vector(1,2,4) > Can't locate auto/vector/new.al in @INC (@INC contains: > /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 > /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 > /usr/lib/perl5/site_perl .) at (eval > 7)[/usr/lib/perl5/5.6.1/perl5db.pl:1521] line 2 I've tried the obvious .pm rewriting but noticed that the extra "::<class>" is hard-coded in the wrapper .cpp. Things expect this suffix at a lower level than I currently comprehend as a novice swigger... I've tried this on swig 1.3.11 (from rh/mdk dist) and latest 1.3.17, with similar results. ----------- So is there some simple directive I'm missing to make Perl classes which don't consume unnecessary namespace? Everything else works like a charm. Thanks in advance, John pliam@xxxxxxxxxx _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Autoconf support suggestion: 00124, Brian Shire |
|---|---|
| Next by Date: | Re: linking problems: 00124, Good Times |
| Previous by Thread: | Autoconf support suggestioni: 00124, Sebastian Huber |
| Next by Thread: | swig and perl580 and sun solaris compiler 5.3: 00124, Good Times |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |