This application is a Kotlin/Native HTTP client using C Interop and libcurl. It bases on the relative JetBrains tutorial to build a Kotlin/Native HTTP client on Windows.
- Clone the repository or download the project as a ZIP file.
- Download the curl library for Windows (based on your computer processor).
- Download the cacert.pem file. This file is needed to perform the HTTP requests correctly
- Inside
build.gradle.kts
file, change theincludePath
val based on the position of theinclude
subfolder of the curl library (to let the application pick curl headers and functions). - Inside
libcurl.def
file, change the lastlinkerOpts
entry based on the position of thelib
subfolder of the curl library (to let the application pick thelibcurl.a
file). - Inside
Main.kt
file, change thecertPath
val based on the position of thecacert.pem
file. - Build the project. It will generate an exe file per build variant in build/bin/native.
To be run correctly, the exe file needs to access the libcurl.dll
file. Copy that file from the bin
subfolder of the curl library into the same directory as the exe file.
libcurl.dll
file with a different name. In my case, I needed to call it libcurl-4.dll
to make the exe file run with no errors. Pay attention to the error message Windows will display.
Lastly, run the exe from cmd.
For any trouble with building or running the app, feel free to open an issue.