I would like to report that I did a mini-fork of SWIG a long time ago to use IntPtr instead of HandleRef (for .NET Compact Framework support), and my IntPtr-based wrappers have always worked fine on desktop Windows, even though there is supposedly a risk of premature garbage collection (in fact my version still uses HandleRef by default, but switches to IntPtr in case USE_INTPTR or COMPACT_FRAMEWORK_COMPATIBLE is defined.)

Where is it documented that HandleRef is disappearing? It is not deprecated as of .NET 4.5.

From:        Build Master <akbuildmaster@gmail.com>
To:        swig-user@lists.sourceforge.net
Date:        04/17/2013 02:30 PM
Subject:        [Swig-user] WinRT and C# P/Invoke

Hello SWIG,

We've been successfully generating C# bindings to our C API for various .NET/Mono platforms.
However, the recent WinRT platforms introduced changes in .NET core so that many constructs are
no longer supported, e.g., HandleRef  which is at the core if SWIG .NET P/Invoke support.

We wonder if this part of language extension code can be adapted to support WinRT.
For example, replace HandleRef with SafeHandle.

I don't consider myself a .NET expert so please feel free correct me if I'm wrong.

Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
Swig-user mailing list