Class MarshalTk
Contains extra marshalling utilities that aren't available in the normal Marshal class.
Inherited Members
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 |
---|---|---|
Int |
ptr | An unmanaged pointer allocated with |
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 |
---|---|---|
Int |
ptr | An unmanaged pointer allocated with |
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 |
---|---|---|
Int |
ptr | A pointer to a null-terminated byte array. |
Returns
Type | Description |
---|---|
string | A |
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 |
---|---|
Int |
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 |
Returns
Type | Description |
---|---|
Int |
An unmanaged pointer containing the marshaled string.
This pointer must be freed with |