SWIGTYPE && input typemaps now assume object has been moved - Go and OCaml

Not fully implemented and Untested.
Go's implementation needs fixing to fully support typemaps
before this can be done.
OCaml implementation does not have support for releasing ownership
which is required to add error checking preventing double deletes.
This commit is contained in:
William S Fulton 2022-08-24 08:39:36 +01:00
commit 3f622ea65e
2 changed files with 6 additions and 4 deletions

View file

@ -388,8 +388,9 @@
%typemap(gotype) SWIGTYPE &&
%{$gotypename%}
%typemap(in) SWIGTYPE &&
%{ $1 = *($&1_ltype)&$input; %}
%typemap(in, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter)
%{ $1 = *($&1_ltype)&$input;
rvrdeleter.reset($1); %}
%typemap(out) SWIGTYPE &&
%{ *($&1_ltype)&$result = $1; %}

View file

@ -40,9 +40,10 @@
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
}
%typemap(in) SWIGTYPE && {
%typemap(in, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
}
rvrdeleter.reset($1);
%}
%typemap(varin) SWIGTYPE & {
$1 = *(($ltype) caml_ptr_val($input,$1_descriptor));