|
RE: SWIG-PERL-Vector of pointers: msg#00115programming.swig
> 1) if I run SWIG on the module above I don't get the output you report. > Names apart, I do get the same as for std::vector<int>. Are you > processing the very same code you quoted above? With which version of > SWIG? With which command-line arguments? I'm using SWIG 1.3.19 under Windows ( :-( ) (compiling using VC++). The command to generate SWIG file is: swig.exe -c++ -includeall -Wall -perl5 -o $(InputDir)\$(InputName)_wrap.h $(InputPath)" > 2) I don't mean to be rude, but why are you interested in the generated > code at all? For practical purposes, that is the same as object code. > Instead: I've written a perl program that uses Vector of structs and Vector of Ints. For example, size method on the int vector works fine and the size method on the struct vector generates a type error. I looked at the generated file to see different code generated for struct vector and int vector. I fixed this problem by appending struct keyword when declaring the struct vector template. > 3) in which way does not the above "work"? Does it not compile? Does it > not do what you expect in Perl? Can you post a minimal example which I > can try to compile and run? The following template declaration generated the code correctly. %template(BpDataStruct_SLI_vector) std::vector<struct SBSD::BpDataStruct_SLI>; If you remove the keyword struct, the generated code looks different. >> I assume you support Vector of Structs right? > We do. Do you have any perl example that uses Vector of pointers? Thanks a lot. -sanjay -----Original Message----- From: Luigi Ballabio [mailto:luigi.ballabio@xxxxxxxxxxxxx] Sent: Tuesday, November 18, 2003 12:38 AM To: Nair, Sanjay S Cc: luigi.ballabio@xxxxxxxxxxxxx; swig@xxxxxxxxxxxxxxx Subject: Re: [Swig] SWIG-PERL-Vector of pointers On 2003.11.17 18:36, "Nair, Sanjay S" wrote: > I written a small test class > > %module SbsdSLI > %include "std_vector.i" > > typedef struct Abcd { > int i; > short j; > } Abcd; > > %template(Abcd_vector) std::vector<Abcd>; > > class Test { > public: > void disable( std::vector<Abcd_vector>& abcdVector ); > }; > > SWIG generated code only has 3 parameters ( unlike the int vector > which has 4) > > static swig_type_info _swigt__p_Abcd_vector[] = {{"_p_Abcd_vector", > 0, > "Abcd_vector &", 0},{"_p_Abcd_vector"},{0}}; > > I assume you support Vector of Structs right? We do. However: 1) if I run SWIG on the module above I don't get the output you report. Names apart, I do get the same as for std::vector<int>. Are you processing the very same code you quoted above? With which version of SWIG? With which command-line arguments? 2) I don't mean to be rude, but why are you interested in the generated code at all? For practical purposes, that is the same as object code. Instead: 3) in which way does not the above "work"? Does it not compile? Does it not do what you expect in Perl? Can you post a minimal example which I can try to compile and run? Later, Luigi _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re[3]: Directors and passing args by value.: 00115, Kerim Borchaev |
|---|---|
| Next by Date: | Re: Directors and passing args by value.: 00115, Mark Rose |
| Previous by Thread: | RE: SWIG-PERL-Vector of pointersi: 00115, Nair, Sanjay S |
| Next by Thread: | Re: SWIG-PERL-Vector of pointers: 00115, Luigi Ballabio |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |