From: Mark Volkmann Date: 2006-03-21T13:30:48+09:00 Subject: Re: swig, c++, use string ------=_Part_9701_28204120.1142915432182 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I've attached a zip that includes working code. To build it, enter "build.sh". You may need to change the definition of RBDIR in this file. To use it from irb, enter these statements. require 'RubyBidon.so' include RubyBidon bidon fctBidon('foo') This outputs "bouh" "foo salt bidon" On 3/20/06, killy-kun wrote: > Sorry, I made an error last time, I corrected this : > replaced "%module Str" by "%module Str" into the str.i file. > > Now the require instruction works fine, but the type "error" is still > the same : > > #--------------------# > [gnargeot@dptinfo ex3]$ swig -c++ -ruby *.i > [gnargeot@dptinfo ex3]$ gcc -c -fpic *_wrap.cxx -I. -I$RBDIR > [gnargeot@dptinfo ex3]$ gcc -shared -fpic *_wrap.o -lstdc++ -o Str.so > [gnargeot@dptinfo ex3]$ irb --simple-prompt > >> require 'Str.so' > =3D> true > >> include Str > =3D> Object > >> bidon > =3D> # > #--------------------# > > Best regards, > > Guillaume > > -- R. Mark Volkmann Object Computing, Inc. ------=_Part_9701_28204120.1142915432182 Content-Type: application/x-gzip; name="bidon.tar.gz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bidon.tar.gz" X-Attachment-Id: f_el1qbkfy H4sICEKBH0QAA2JpZG9uLnRhcgDtl9tum0AQQP28XzEiddXG4n6LkqYPUV/y6h+IYCH2SoRFLKu4 ivrvXRaMSeLGUSVsRZkj2cDMsLN4mItTlvHSnk2Ko4jDUB8VL4/63HUCJ44dJ4iV3HWiIJpBOO22 OqRokhpgVnPevGV3SP9BSXX89be1nshHG+AoCP4Zf9cLu/hHcRx7noq/14rAmWg/z/jk8T9jJS1k lsMP0dSsXP0kRDTZ5WV3BfrF+Pb96rn0njY3WkF5KRoYqb6CUManfijk3fT5L1mRWWKiAnCo/vuu N+R/5Edt/vuei/l/DMQjW4FJFwswa5n+hnOLkbPlza/b5bUtRW0XLLVbhe1aFzbzLyKzYKXc2GRs w2lSvLCMdpYrSpUHMO8rRtX6tKrg/O6xTiqLbjZg3lrq80Uv15mKdVLnWW/fdSa+vYODWahyo/fL Yanc6UJkCY5F578Y938VmUl8HOr/vuvu+n8rd70gxPw/CkP/N/oZ0CBEirbJl8lDLqqE5m1/1wPA /t6/bfvwREDRm9W5uNLX6gSuQcACDBBJ0XQZbWyVjazLzvjP4KIfOl4tqNYxUi7Xe28+9Q/5QRnn P5vIx8H539/9/3OiWM//Toz5fwzmDzyTRb5rpYTMn8ieqjBX+TkfxKok3HWJaTFjJB/MT/1cCIIg CIIgCIIgCIIgCIIgCPKZ+Qs2b6WTACgAAA== ------=_Part_9701_28204120.1142915432182--