# C interop

**URL:** <https://discuss.kotlinlang.org/t/c-interop/11031>\
**Category:** Native\
**Created:** [January 5, 2019, 4:09pm UTC](https://discuss.kotlinlang.org/t/c-interop/11031 "2019-01-05T16:09:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![solomkaromanolegovech](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@solomkaromanolegovech](https://discuss.kotlinlang.org/u/solomkaromanolegovech)\
**Post date:** [January 5, 2019, 4:09pm UTC](https://discuss.kotlinlang.org/t/c-interop/11031/1 "2019-01-05T16:09:14Z")

</div>

Hello. Tried to build a simple kotlin example with interop using libcurl. I did everything by example. When compiling does not find the imported functions.  
When trying to use this [Minimalistic C library and Kotlin/Native – Eugene Petrenko](https://jonnyzzz.com/blog/2018/05/28/minimalistic-kn/) example, the same problem was released(“main.kt:3:15: error: unresolved reference: foo  
val z = lib.foo()”)  
kotlin native 1.3.11  
Windows 10 64bit

[Kotlin c interop.7z](https://discuss.kotlinlang.org/uploads/short-url/cmLqhqtwI1mP7jCew6wegYKDvpW.7z) (6.3 KB)

---

<div class="post-metadata">

**Author:** ![msink](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/msink/32/3336_2.png) [@msink](https://discuss.kotlinlang.org/u/msink)\
**Post date:** [January 6, 2019, 8:50am UTC](https://discuss.kotlinlang.org/t/c-interop/11031/2 "2019-01-06T08:50:52Z")

</div>

How did you compile `lib.c` ?  
On Windows it must be compiled by msys2-mingw64.

---

<div class="post-metadata">

**Author:** ![solomkaromanolegovech](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@solomkaromanolegovech](https://discuss.kotlinlang.org/u/solomkaromanolegovech)\
**Post date:** [January 9, 2019, 8:52am UTC](https://discuss.kotlinlang.org/t/c-interop/11031/3 "2019-01-09T08:52:15Z")

</div>

Compiled “gcc” installed in kotlin / native

---

<div class="post-metadata">

**Author:** ![msink](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/msink/32/3336_2.png) [@msink](https://discuss.kotlinlang.org/u/msink)\
**Post date:** [January 9, 2019, 10:22am UTC](https://discuss.kotlinlang.org/t/c-interop/11031/4 "2019-01-09T10:22:09Z")

</div>

Works for me: [kotlin\_c\_interop.zip](https://discuss.kotlinlang.org/uploads/short-url/4TiTERdI7Ht7KaV0K66N9qtmMlG.zip) (1.2 KB)

---

<div class="post-metadata">

**Author:** ![solomkaromanolegovech](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@solomkaromanolegovech](https://discuss.kotlinlang.org/u/solomkaromanolegovech)\
**Post date:** [January 11, 2019, 10:48am UTC](https://discuss.kotlinlang.org/t/c-interop/11031/5 "2019-01-11T10:48:47Z")

</div>

Your example works. Thanks you. I registered all the paths and as in the bat file and everything now works.  
There is another question for you if I can use dll from delphi if I write ‘.h’ and 'to them. lib '. And will it be possible to connect dll without header files, such as in python?
