#837 [ruby] Vector template doesn't work

closed
ruby (61)
5
2009-11-08
2007-06-25
Blakharaz
No

When I use a vector template like

%template(GameObjectVector) std::vector< rl::GameObject* >;

in my code I just geht an exception when loading the DLL:

#<NameError: undefined method `reject!' for class `RlScript::GameObjectVector'>

The generated CXX file looks OK for my (uneducated) eyes. Maybe the exclamation mark doesn't work correctly. I use SWIG trunk from SVN (revision 9855).

Discussion

  • Gonzalo Garramuno

    Logged In: YES
    user_id=961712
    Originator: NO

    Hmm... I'm unable to reproduce your problem. This works for me with latest SVN.

    Does this work for you?

    ---- crap.i ----

    %module crap

    %include std_vector.i

    %inline %{

    struct GameObj {
    };

    %}

    %template(GameObjVector) std::vector< GameObj* >;
    ----- crap.i ----

    From a MSVC console:

    $ vcvars32.bat
    $ swig -c++ -ruby crap.i
    $ cl.exe -IC:/ruby/lib/ruby/1.8/i386-mswin32 -GR -EHsc crap_wrap.cxx -link -dll -LIBPATH:C:/

    ruby/lib msvcrt-ruby18.lib -out:crap.dll

    $ irb
    irb> require 'crap'
    irb> Crap::GameObjVector.new
    => std::vector<GameObj *,std::allocator<GameObj * > > []

     
  • Gonzalo Garramuno

    Logged In: YES
    user_id=961712
    Originator: NO

    err.. that -LIBPATH:C:/ruby/lib was to be on the same line ( I hate web forms ).

     
  • Olly Betts

    Olly Betts - 2007-09-18
    • summary: Vector template doesn't work --> [ruby] Vector template doesn't work
     
  • William Fulton

    William Fulton - 2009-11-08

    Please reopen and provide a standalone example demonstrating this issue if it still exists.

     
  • William Fulton

    William Fulton - 2009-11-08
    • status: open --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks