ObjectiveCMarshal.Initialize Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initialize the Objective-C marshalling API.
public:
static void Initialize(delegate* unmanaged<void> ^ beginEndCallback, delegate* unmanaged<IntPtr , int> ^ isReferencedCallback, delegate* unmanaged<IntPtr , void> ^ trackedObjectEnteredFinalization, System::Runtime::InteropServices::ObjectiveC::ObjectiveCMarshal::UnhandledExceptionPropagationHandler ^ unhandledExceptionPropagationHandler);
public static void Initialize (delegate* unmanaged<void> beginEndCallback, delegate* unmanaged<IntPtr, int> isReferencedCallback, delegate* unmanaged<IntPtr, void> trackedObjectEnteredFinalization, System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal.UnhandledExceptionPropagationHandler unhandledExceptionPropagationHandler);
static member Initialize : delegate* unmanaged<unit> * delegate* unmanaged<nativeint, int> * delegate* unmanaged<nativeint, unit> * System.Runtime.InteropServices.ObjectiveC.ObjectiveCMarshal.UnhandledExceptionPropagationHandler -> unit
Public Shared Sub Initialize (beginEndCallback As delegate* unmanaged<Void>, isReferencedCallback As delegate* unmanaged< As IntPtr, Integer>, trackedObjectEnteredFinalization As delegate* unmanaged< As IntPtr, Void>, unhandledExceptionPropagationHandler As ObjectiveCMarshal.UnhandledExceptionPropagationHandler)
Parameters
- beginEndCallback
- delegate* unmanaged<Void>
Called when tracking begins and ends.
Called to determine if a managed object instance is referenced elsewhere, and must not be collected by the GC.
- trackedObjectEnteredFinalization
-
delegate* unmanaged<nativeint, Void>
Called when a tracked object enters the finalization queue.
- unhandledExceptionPropagationHandler
- ObjectiveCMarshal.UnhandledExceptionPropagationHandler
Handler for the propagation of unhandled Exceptions across a managed -> native boundary (that is, Reverse P/Invoke).
Remarks
All unmanaged function pointers must be written in native code since they will be called by the GC and managed code is not able to run at that time.
The beginEndCallback
will be called when reference tracking begins and ends. The associated begin/end pair will never be nested. When using Workstation GC, the begin/end pair will be called on the same thread. When using Server GC, the begin/end pair is not guaranteed to be called on the same thread.
The isReferencedCallback
should return 0 for not reference or 1 for referenced. Any other value has undefined behavior.