Fwd: GoXapian

Olly Betts olly at survex.com
Mon Nov 12 03:34:44 GMT 2018

On Sun, Nov 11, 2018 at 09:51:09PM -0500, Dave Courtois wrote:
> I setup the environment for the golang branch  and build it without
> problem. Cgo complain about the generated cc file and dosent regonize it as
> swig generated file... curious.

If you want to use Cgo then you probably want to add -cgo to the command
line options passed to swig (see go/Makefile.am).

> There no more problem with the MSet and ESet and all class seem to be
> generated in Go correctly. I will try tomorrow to manually invoke swig
> over your .i file and see if the code is generated properly. The file
> generate-go-execption seem to be for python, is it part of the go
> binding?

That is indeed just copied from the python bindings, and is not
currently used.  There were quite a few leftovers from copying the
Python bindings as a starting point and I removed most of them, but
this one I left as a placeholder as something it probably needed to
give useful mapping of C++ exceptions into Go.

It looks like SWIG's default wrapping of C++ exceptions appears to be to
call _cgo_panic(), which presumably aborts the program.  That's not
very friendly.

I gather than Go doesn't support thrown exceptions, and the equivalent
to a C++ exception is an error type which is returned as a second return
value.  So generate-go-exceptions would ideally generate code to support


More information about the Xapian-discuss mailing list