> For the complete documentation index, see [llms.txt](https://pinvokeisalive.gitbook.io/pinvoke/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pinvokeisalive.gitbook.io/pinvoke/desktopfunctions/kernel32/globalalloc.md).

# GlobalAlloc

### C# Signature:

```cs
[DllImport("kernel32.dll")]
static extern IntPtr GlobalAlloc(uint uFlags, UIntPtr dwBytes);
```

### VB.Net Signature:

```cs
<DllImport("kernel32.dll", ExactSpelling:=True)> _
    Friend Shared Function GlobalAlloc(ByVal flags As Integer, ByVal size As Integer) As IntPtr
    End Function
```

### VB.Net Signature:

```cs
<DllImport("KERNEL32.DLL", EntryPoint:="GlobalAlloc", _
       SetLastError:=True, CharSet:=CharSet.Unicode, _
       ExactSpelling:=True, _
       CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function GlobalAlloc(ByVal src As Long, ByVal dst As Long) As Integer
    ' Leave function empty!
    End Function
```
