Show / Hide Table of Contents

Class MarshalTk

Contains extra marshalling utilities that aren't available in the normal Marshal class.

Inheritance
object
MarshalTk
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OpenTK.Core.Native
Assembly: OpenTK.Core.dll
Syntax
public static class MarshalTk

Methods

FreeStringArrayPtr(IntPtr, int)

Frees a marshaled string that allocated by MarshalStringArrayToPtr.

Declaration
public static void FreeStringArrayPtr(IntPtr ptr, int length)
Parameters
Type Name Description
IntPtr ptr

An unmanaged pointer allocated with MarshalStringArrayToPtr.

int length

The length of the string array.

FreeStringPtr(IntPtr)

Frees a marshaled string that allocated by MarshalStringToPtr.

Declaration
public static void FreeStringPtr(IntPtr ptr)
Parameters
Type Name Description
IntPtr ptr

An unmanaged pointer allocated with MarshalStringToPtr.

MarshalPtrToString(IntPtr)

Marshals a pointer to a null-terminated byte array to a new System.String. This method supports OpenTK and is not intended to be called by user code.

Declaration
public static string MarshalPtrToString(IntPtr ptr)
Parameters
Type Name Description
IntPtr ptr

A pointer to a null-terminated byte array.

Returns
Type Description
string

A System.String with the data from ptr.

MarshalStringArrayToPtr(string[])

Marshals a System.String array to unmanaged memory by calling Marshal.AllocHGlobal for each element.

Declaration
public static IntPtr MarshalStringArrayToPtr(string[] strArray)
Parameters
Type Name Description
string[] strArray

The string array to marshal.

Returns
Type Description
IntPtr

An unmanaged pointer to an array of null-terminated strings.

MarshalStringToPtr(string)

Marshal a System.String to unmanaged memory. The resulting string is encoded in UTF8 and must be freed with FreeStringPtr.

Declaration
public static IntPtr MarshalStringToPtr(string str)
Parameters
Type Name Description
string str

The System.String to marshal.

Returns
Type Description
IntPtr

An unmanaged pointer containing the marshaled string. This pointer must be freed with FreeStringPtr.

In This Article
Back to top Generated by DocFX