We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11f3d20 commit a4b3478Copy full SHA for a4b3478
PDFTronGo/pdftron.i
@@ -235,6 +235,26 @@ import "fmt"
235
}
236
237
238
+// Macro for generating gotype (adding error to return) and cgoout (adding panic recovery to return errors) typemaps
239
+%define ERROR_HANDLING_TYPEMAPS(TYPE)
240
+%typemap(gotype) TYPE "$gotype, error"
241
+%typemap(cgoout) TYPE %{
242
+ var swig_r $gotypes
243
+ var swig_err error
244
+
245
+ func() {
246
+ defer func() {
247
+ if r := recover(); r != nil {
248
+ swig_err = errors.New(fmt.Sprintf("%v", r))
249
+ }
250
+ }()
251
+ swig_r = $cgocall
252
253
254
+ return swig_r, swig_err
255
+%}
256
+%enddef
257
258
%typemap(goout) pdftron::SDF::Obj
259
%{
260
// Without the brackets, swig attempts to turn $1 into a c++ dereference.. seems like a bug
0 commit comments