Class BindingsBase
Provides a common foundation for all flat API bindings and implements the extension loading interface.
Inherited Members
Namespace: OpenTK.Graphics
Assembly: OpenTK.Graphics.dll
Syntax
public abstract class BindingsBase
Constructors
BindingsBase()
Constructs a new BindingsBase instance.
Declaration
public BindingsBase()
Methods
FreeStringArrayPtr(IntPtr, int)
Frees a marshalled string that allocated by MarshalStringArrayToPtr.
Declaration
protected static void FreeStringArrayPtr(IntPtr ptr, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | ptr | An unmanaged pointer allocated with |
| int | length | The length of the string array. |
FreeStringPtr(IntPtr)
Frees a marshalled string that allocated by MarshalStringToPtr.
Declaration
protected static void FreeStringPtr(IntPtr ptr)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | 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
protected static string MarshalPtrToString(IntPtr ptr)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | 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
protected static IntPtr MarshalStringArrayToPtr(string[] str_array)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | str_array | 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
protected static IntPtr MarshalStringToPtr(string str)
Parameters
| Type | Name | Description |
|---|---|---|
| string | str | The |
Returns
| Type | Description |
|---|---|
| IntPtr | An unmanaged pointer containing the marshalled string.
This pointer must be freed with |