# Can I use a C library in my corona app

**URL:** <https://forums.solar2d.com/t/can-i-use-a-c-library-in-my-corona-app/348103>\
**Category:** Newbie Questions\
**Created:** [July 16, 2018, 5:25pm UTC](https://forums.solar2d.com/t/can-i-use-a-c-library-in-my-corona-app/348103 "2018-07-16T17:25:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JTPenn](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/c67d28/32.png) [@JTPenn](https://forums.solar2d.com/u/JTPenn)\
**Post date:** [July 16, 2018, 5:25pm UTC](https://forums.solar2d.com/t/can-i-use-a-c-library-in-my-corona-app/348103/1 "2018-07-16T17:25:40Z")

</div>

I am developing a program for PC, I want the program to be able to create PDFs so I wanted to use luahpdf module

[https://github.com/jung-kurt/luahpdf](https://github.com/jung-kurt/luahpdf)

But turns everytime I try to include the C library in my project corona searches for a lua file

require hpdf

searches for hpdf.lua

require hpdf.c

searches for c.lua in a hpdf folder

Does corona even support including a C library ? and if not then what are my options ?&nbsp;

---

<div class="post-metadata">

**Author:** ![roaminggamer](https://forums.solar2d.com/user_avatar/forums.solar2d.com/roaminggamer/32/134_2.png) [@roaminggamer](https://forums.solar2d.com/u/roaminggamer)\
**Post date:** [July 16, 2018, 5:52pm UTC](https://forums.solar2d.com/t/can-i-use-a-c-library-in-my-corona-app/348103/2 "2018-07-16T17:52:38Z")

</div>

Yes,

You can write a plugin using C and use the native build features to include it in your project.

Alternately, you can submit the plugin to the marketplace ans then you and everyone else can use it when it is approved.

Start here:&nbsp;&nbsp;

- [https://docs.coronalabs.com/native/plugin/index.html](https://docs.coronalabs.com/native/plugin/index.html)
- [https://docs.coronalabs.com/native/plugin/index.html#native-c](https://docs.coronalabs.com/native/plugin/index.html#native-c)

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [July 16, 2018, 7:13pm UTC](https://forums.solar2d.com/t/can-i-use-a-c-library-in-my-corona-app/348103/3 "2018-07-16T19:13:11Z")

</div>

You can make C/C++ libraries usable by Corona by creating a plugin that lets you create a Lua to C/C++ interface. For Windows desktop builds, you will create a .dll&nbsp;file to include in your project that handles the C side of the equation. Building Windows desktop plugins include a bit more work than plugins for Android/iOS. You can look at this project which has a Windows plugin example in it:

[https://github.com/coronalabs/plugins-sample-memoryBitmap](https://github.com/coronalabs/plugins-sample-memoryBitmap)

Rob

---

<div class="post-metadata">

**Author:** ![roaminggamer](https://forums.solar2d.com/user_avatar/forums.solar2d.com/roaminggamer/32/134_2.png) [@roaminggamer](https://forums.solar2d.com/u/roaminggamer)\
**Post date:** [July 16, 2018, 5:52pm UTC](https://forums.solar2d.com/t/can-i-use-a-c-library-in-my-corona-app/348103/4 "2018-07-16T17:52:38Z")

</div>

Yes,

You can write a plugin using C and use the native build features to include it in your project.

Alternately, you can submit the plugin to the marketplace ans then you and everyone else can use it when it is approved.

Start here:&nbsp;&nbsp;

- [https://docs.coronalabs.com/native/plugin/index.html](https://docs.coronalabs.com/native/plugin/index.html)
- [https://docs.coronalabs.com/native/plugin/index.html#native-c](https://docs.coronalabs.com/native/plugin/index.html#native-c)

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [July 16, 2018, 7:13pm UTC](https://forums.solar2d.com/t/can-i-use-a-c-library-in-my-corona-app/348103/5 "2018-07-16T19:13:11Z")

</div>

You can make C/C++ libraries usable by Corona by creating a plugin that lets you create a Lua to C/C++ interface. For Windows desktop builds, you will create a .dll&nbsp;file to include in your project that handles the C side of the equation. Building Windows desktop plugins include a bit more work than plugins for Android/iOS. You can look at this project which has a Windows plugin example in it:

[https://github.com/coronalabs/plugins-sample-memoryBitmap](https://github.com/coronalabs/plugins-sample-memoryBitmap)

Rob
