title: Kotlin/Native - How to Use a C Library and Klib file?
body: <p>I am new to Kotlin/Native as I assume many others are and wish to use a C library from Kotlin. There is documentation out there and a couple tutotials that get you 85% and just miss the mark. And YES, I tried to read about everything before I asked the question.</p>
  
  <p>The flow to utilize a C library in Kotlin is easy to find.</p>
  
  <p>1) create a .def file  ---Ok!</p>
  
  <p>2) use the tool cinterop on the .def file to create a .klib file -- OK</p>
  
  <p>----NOW HOW DO YOU USE IT??---</p>
  
  <p>Specifically, now that we have a .klib file, call it "XXX.klib", how do we import the symbols?</p>
  
  <p>Is one supposed to use gradle and add a dependency of the klib file?
  Is there a default folder structure to put the .Klib in?
  Is one supposed to some how associate the Klib with a package?</p>
  
  <p>The issue I am having with gradle at the time is I really don't understand what is relevant to the thing I am doing vs what you find on the internet.  Somebody just saying..."Here's my gradle file" really hurts more than than it helps some times because it does not make you smarter just copying it.</p>
  
  <p>I have looked at the link 
  <a href="https://medium.com/androidiots/the-magic-of-kotlin-native-part-2-49097c2dea1a" rel="nofollow noreferrer">https://medium.com/androidiots/the-magic-of-kotlin-native-part-2-49097c2dea1a</a></p>
  
  <p>I have also looked at a very near answer to my question
  <a href="https://stackoverflow.com/questions/57170318/adding-a-klib-library-to-kotlin-multiplatform">Adding a `.klib` library to kotlin multiplatform</a></p>
  
  <p>But the answers fell short.</p>