- Subject: [slang-users] Generating ruby bindings to s-lang using swig
- From: "Jacob Grydholt Jensen" <grydholt@xxxxxxxxx>
- Date: Tue, 22 Aug 2006 23:50:03 +0200
Hi,
I would like to make ruby bindings to s-lang with swig. I am a newbie
at both s-lang and swig and my C is rusty, so please point me to
appropriate documentation
if I haven't done my homework properly.
I have created a slang.i file with the following content:
%module slang
%{
/* Includes the header in the wrapper code */
#include "/usr/local/include/slang.h"
%}
/* Parse the header file to generate wrappers */
%include "/usr/local/include/slang.h"
And I run it as:
$ swig -ruby slang.i
/usr/local/include/slang.h:422: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:438: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:449: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:459: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:469: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:480: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:491: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:514: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:523: Warning(314): 'next' is a ruby
keyword, and it will renamed as 'C_next'
/usr/local/include/slang.h:539: Error: Syntax error in input(1).
/usr/local/include/slang.h:1432: Warning(454): Setting a
pointer/reference variable may leak memory.
I notice that swig reports an error in line 539, but it still
generates a slang_wrap.c file, which I try to compile with:
$ gcc slang_wrap.c -I/usr/local/include
-I/usr/local/lib/ruby/1.8/arm-openbsd3.9
slang_wrap.c: In function `field_name_get':
slang_wrap.c:7309: error: `field_name' undeclared (first use in this function)
slang_wrap.c:7309: error: (Each undeclared identifier is reported only once
slang_wrap.c:7309: error: for each function it appears in.)
slang_wrap.c: In function `field_name_set':
slang_wrap.c:7322: error: `field_name' undeclared (first use in this function)
slang_wrap.c: In function `offset_get':
slang_wrap.c:7339: error: `offset' undeclared (first use in this function)
slang_wrap.c: In function `offset_set':
slang_wrap.c:7352: error: `offset' undeclared (first use in this function)
slang_wrap.c: In function `type_get':
slang_wrap.c:7364: error: `type' undeclared (first use in this function)
slang_wrap.c: In function `type_set':
slang_wrap.c:7377: error: `type' undeclared (first use in this function)
slang_wrap.c: In function `read_only_get':
slang_wrap.c:7389: error: `read_only' undeclared (first use in this function)
slang_wrap.c: In function `read_only_set':
slang_wrap.c:7402: error: `read_only' undeclared (first use in this function)
So obviously something went wrong. I guess the errors are related so I
will concentrate on the first with field_name. The file slang_wrap.c
has the following content in lines 7305 - 7312:
SWIGINTERN VALUE
field_name_get(VALUE self) {
VALUE _val;
_val = SWIG_FromCharPtr(field_name);
return _val;
}
I am running the following versions:
$swig -version
SWIG Version 1.3.29
Compiled with g++ [zaurus-unknown-openbsd3.9]
Please see http://www.swig.org for reporting bugs and further information
$slsh --version
slsh version 0.7.5-0
S-Lang Library Version: 2.0.6
$ ruby --version
ruby 1.8.4 (2005-12-24) [arm-openbsd3.9]
--
/grydholt
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]