[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Ruby SWIG-based bindings

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: 2005-01-06 05:02:08 CET


In <20050105204848.GB27717@lyra.org>
  "Re: [PATCH] Ruby SWIG-based bindings" on Wed, 5 Jan 2005 12:48:48 -0800,
  Greg Stein <gstein@lyra.org> wrote:

> > The codes generated by %include sometimes need some type
> > declarations. We have to use #include before the codes
> > generated by %include. So, I swapped %include position for
> > #include position.
> I've found that it is rarely necessary to swap these around,
> especially given the fact that it worked before. I'd be interested in
> seeing the actual compile error that is produced.

First, it is a problem (maybe only) for Ruby-SWIG.

Ruby-SWIG generates prototype declarations of deconstructor
when SWIG finds struct declarations while processing
%include. And the prototype declarations uses `svn_*_t *' at
the argument declarations. This is the problem.

That is:

  * the problem is not always happened. It is happened only
    when there some struct declarations.

  * the problem may be not happened other SWIG bindings.

Here is the compile error messages when *NOT* swap them in

  subversion/bindings/swig/ruby/svn_ra.c:578: error: parse error before '*' token
  subversion/bindings/swig/ruby/svn_ra.c:581: error: parse error before '*' token
  subversion/bindings/swig/ruby/svn_ra.c:584: error: parse error before '*' token

And the corresponding part of svn_ra.c:

     swig_class cSvn_ra_reporter_t;
578: static void free_svn_ra_reporter_t(svn_ra_reporter_t *);

     swig_class cSvn_ra_callbacks_t;
581: static void free_svn_ra_callbacks_t(svn_ra_callbacks_t *);

     swig_class cSvn_ra_plugin_t;
584: static void free_svn_ra_plugin_t(svn_ra_plugin_t *);


601: #include "svn_ra.h"

     #ifdef SWIGPYTHON
     #include "swigutil_py.h"

     #ifdef SWIGJAVA
     #include "swigutil_java.h"

     #ifdef SWIGPERL
     #include "swigutil_pl.h"

     #ifdef SWIGRUBY
     #include "swigutil_rb.h"

> I would imagine one of two things are happening:
> * one of the SVN headers isn't including everything necessary for it
> to be self-consistent
> * one of the processed headers has an "extern" declaration in it. SWIG
> will write externs into the file where the %include happens, which
> can occur before the #include. Subversion headers should not be
> using the extern keyword, so we should fix them if this is the case.

So, my answer is the first one.

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jan 6 05:03:24 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.