File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -263,8 +263,8 @@ import "fmt"
263263
264264// Macro for generating gotype (adding error to return) and cgoout (adding panic recovery to return errors) typemaps
265265%define EXCEPTION_HANDLING_TYPEMAP (TYPE)
266- %typemap(gotype) TYPE "$gotype, error"
267- %typemap(cgoout) TYPE %{
266+ %typemap(gotype, out ) TYPE "$gotype, error"
267+ %typemap(cgoout, out ) TYPE %{
268268 var swig_r $gotypes
269269 var swig_err error
270270
@@ -297,6 +297,23 @@ EXCEPTION_HANDLING_TYPEMAP(int)
297297EXCEPTION_HANDLING_TYPEMAP(ptrdiff_t )
298298EXCEPTION_HANDLING_TYPEMAP(size_t )
299299
300+ // Generate gotype and cgoout typemaps for void separately
301+ %typemap(gotype, out) void "error"
302+ %typemap(cgoout, out) void %{
303+ var swig_err error
304+
305+ func () {
306+ defer func () {
307+ if r := recover (); r != nil {
308+ swig_err = errors.New (fmt.Sprintf (" %v" , r))
309+ }
310+ }()
311+ $cgocall
312+ }()
313+
314+ return swig_err
315+ %}
316+
300317// Handle edge case: SDF::Obj returns nil when internal pointer is invalid
301318%typemap(goout) pdftron::SDF::Obj
302319%{
You can’t perform that action at this time.
0 commit comments