<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn" -->

---
title: bgfx is switching to IDL to generate API | daily.dev
description: The author explains bgfx's shift from manually maintaining C++/C99 API bindings to generating them from an Interface Definition Language (IDL) written in Lua....
canonical: https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: bgfx is switching to IDL to generate API | daily.dev
og:description: The author explains bgfx's shift from manually maintaining C++/C99 API bindings to generating them from an Interface Definition Language (IDL) written in Lua....
og:url: https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn
og:image: https://api.daily.dev/og/posts/j34zDscsn.png
og:image:alt: bgfx is switching to IDL to generate API
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# bgfx is switching to IDL to generate API

**[Overview — bgfx 1.146.9292 documentation](https://daily.dev/sources/bkaradzic)** · 7 min read · 0 upvotes · 0 comments

## Summary

The author explains bgfx's shift from manually maintaining C++/C99 API bindings to generating them from an Interface Definition Language (IDL) written in Lua. The manual process required duplicating function declarations across headers, vtable structs, and implementation shims, and was error-prone. The new IDL-based pipeline, developed with input from cloudwu, generates C++ and C99 headers, translation wrappers, shared library shims, and Doxygen comments from a single source of truth, and also opens the door to configurable naming conventions and API versioning wrappers.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://bkaradzic.github.io/posts/idl>

## Questions this post answers

### Why did bgfx switch from manually written C99 bindings to an IDL-based code generator?

Manually maintaining bgfx's C99 bindings required duplicating each function across a C header declaration, a vtable entry, and an implementation wrapper, which was tedious and error-prone; functions were sometimes forgotten or left unexposed to C99. bgfx now describes its API once in a Lua-based IDL (scripts/bgfx.idl), from which C++ and C99 headers, translation wrappers, shared library shims, and Doxygen comments are generated automatically.

_Developers wrapping C++ libraries for other languages can find similar API-generation approaches on daily.dev._

### What IDL format does bgfx use to describe its API functions?

bgfx describes its API using a Lua-based domain-specific language created with input from developer cloudwu, rather than JSON tables or a standard IDL tool. Each function, like createVertexBuffer, is defined with its return type, parameters, types, and Doxygen-style comments in a single Lua block, from which C++ and C99 headers plus wrappers are generated.

_daily.dev surfaces posts like this for engineers designing custom code-generation pipelines for cross-language APIs._

## Similar posts on daily.dev

- [The bgfx shader compiler, 14 years of not being a compiler](https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae) · Overview — bgfx 1.146.9292 documentation · 0 upvotes · 0 comments
- [Google Rewrites Critical C Dependencies to Rust Using AI and Differential Fuzzing](https://daily.dev/posts/google-rewrites-critical-c-dependencies-to-rust-using-ai-and-differential-fuzzing-4io3x5gw7) · InfoQ · 5 upvotes · 2 comments
- [Writing a C preprocessor for bgfx shader compiler](https://daily.dev/posts/writing-a-c-preprocessor-for-bgfx-shader-compiler-px6oafgu6) · Overview — bgfx 1.146.9292 documentation · 2 upvotes · 0 comments
- [No Graphics API — Sebastian Aaltonen](https://daily.dev/posts/no-graphics-api-sebastian-aaltonen-bwui0vx4m) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#c](https://daily.dev/tags/c)

[View this post on daily.dev](https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"bgfx is switching to IDL to generate API","url":"https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn"},"datePublished":"2026-08-23T12:17:04.564Z","dateModified":"2026-08-23T12:20:21.645Z","description":"The author explains bgfx's shift from manually maintaining C++/C99 API bindings to generating them from an Interface Definition Language (IDL) written in Lua....","image":"https://media.daily.dev/image/upload/s--CxzD6vbw--/f_auto/v1722860399/public/Placeholder%2005","thumbnailUrl":"https://media.daily.dev/image/upload/s--CxzD6vbw--/f_auto/v1722860399/public/Placeholder%2005","isAccessibleForFree":true,"articleSection":"Overview — bgfx 1.146.9292 documentation","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Overview — bgfx 1.146.9292 documentation","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/bkaradzic"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"architecture,c","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Overview — bgfx 1.146.9292 documentation","item":"https://daily.dev/sources/bkaradzic"},{"@type":"ListItem","position":3,"name":"bgfx is switching to IDL to generate API"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/bgfx-is-switching-to-idl-to-generate-api-j34zdscsn#faq","mainEntity":[{"@type":"Question","name":"Why did bgfx switch from manually written C99 bindings to an IDL-based code generator?","acceptedAnswer":{"@type":"Answer","text":"Manually maintaining bgfx's C99 bindings required duplicating each function across a C header declaration, a vtable entry, and an implementation wrapper, which was tedious and error-prone; functions were sometimes forgotten or left unexposed to C99. bgfx now describes its API once in a Lua-based IDL (scripts/bgfx.idl), from which C++ and C99 headers, translation wrappers, shared library shims, and Doxygen comments are generated automatically. Developers wrapping C++ libraries for other languages can find similar API-generation approaches on daily.dev."}},{"@type":"Question","name":"What IDL format does bgfx use to describe its API functions?","acceptedAnswer":{"@type":"Answer","text":"bgfx describes its API using a Lua-based domain-specific language created with input from developer cloudwu, rather than JSON tables or a standard IDL tool. Each function, like createVertexBuffer, is defined with its return type, parameters, types, and Doxygen-style comments in a single Lua block, from which C++ and C99 headers plus wrappers are generated. daily.dev surfaces posts like this for engineers designing custom code-generation pipelines for cross-language APIs."}}]}
```

