---
name: "wl_resource"
section: "3"
platform: "linux"
package: "wayland-docs"
version: "1.26.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/wl_resource"
---

# wl\_resource(3)

## NAME

wl\_resource

## SYNOPSIS

\#include \<wayland-server.h\>

### Public Member Functions

void **wl\_resource\_post\_error\_vargs** (struct **wl\_resource** \*resource, uint32\_t code, const char \*msg, va\_list argp)\
 void **wl\_resource\_post\_error** (struct **wl\_resource** \*resource, uint32\_t code, const char \*msg,...)\
 const char \* **wl\_resource\_get\_class** (const struct **wl\_resource** \*resource)\
 const struct **wl\_interface** \* **wl\_resource\_get\_interface** (struct **wl\_resource** \*resource)\
 struct **wl\_resource** \* **wl\_resource\_create** (struct **wl\_client** \***client**, const struct **wl\_interface** \*interface, int **version**, uint32\_t id)\

### Data Fields

struct **wl\_object** **object**\
 **wl\_resource\_destroy\_func\_t** **destroy**\
 struct **wl\_list** **link**\
 struct **wl\_signal** **deprecated\_destroy\_signal**\
 struct **wl\_client** \* **client**\
 void \* **data**\
 int **version**\
 **wl\_dispatcher\_func\_t** **dispatcher**\
 struct wl\_priv\_signal **destroy\_signal**\
 struct **wl\_signal** **destroy\_signal**\

## Member Function Documentation

### struct wl\_resource \* wl\_resource\_create (struct wl\_client \* client, const struct wl\_interface \* interface, int version, uint32\_t id)

Create a new resource object

**Parameters**

**client The client owner of the new resource.** \
 *interface* **The interface of the new resource.** \
 **version The version of the new resource.** \
 *id* **The id of the new resource. If 0, an available id will be used.**

**Listeners added with** *wl\_client\_add\_resource\_created\_listener* **will be notified at the end of this function.**

### const char \* wl\_resource\_get\_class (const struct wl\_resource \* resource)

**Retrieve the interface name (class) of a resource object.**

**Parameters**

*resource* **The resource object**

### const struct wl\_interface \* wl\_resource\_get\_interface (struct wl\_resource \* resource)

**Get the interface of a resource object**

**Parameters**

*resource* **The resource object**

**Returns**

**The interface of the object associated with the resource**

**Since**

**1.24**

### void wl\_resource\_post\_error (struct wl\_resource \* resource, uint32\_t code, const char \* msg, ...)

**Post a protocol error**

**Parameters**

*resource* **The resource object** \
 *code* **The error code** \
 *msg* **The error message format string** \
 *...* **The format string arguments**

### void wl\_resource\_post\_error\_vargs (struct wl\_resource \* resource, uint32\_t code, const char \* msg, va\_list argp)

**Post a protocol error**

**Parameters**

*resource* **The resource object** \
 *code* **The error code** \
 *msg* **The error message format string** \
 *argp* **The format string argument list**

## Field Documentation

### struct wl\_client \* wl\_resource::client

### void \* wl\_resource::data

### struct wl\_signal wl\_resource::deprecated\_destroy\_signal

### wl\_resource\_destroy\_func\_t wl\_resource::destroy

### struct wl\_priv\_signal wl\_resource::destroy\_signal

### struct wl\_signal wl\_resource::destroy\_signal

### wl\_dispatcher\_func\_t wl\_resource::dispatcher

### struct wl\_list wl\_resource::link

### struct wl\_object wl\_resource::object

### int wl\_resource::version

## Author

**Generated automatically by Doxygen for Wayland from the source code.**
