Skip to content

A simple Kotlin/Native HTTP client with C Interop and libcurl built on Windows.

Notifications You must be signed in to change notification settings

nicola-95/simple-win-http-client

Repository files navigation

simple-win-http-client

Introduction

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.

Getting start

  • 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 the includePath val based on the position of the include subfolder of the curl library (to let the application pick curl headers and functions).
  • Inside libcurl.def file, change the last linkerOpts entry based on the position of the lib subfolder of the curl library (to let the application pick the libcurl.a file).
  • Inside Main.kt file, change the certPath val based on the position of the cacert.pem file.
  • Build the project. It will generate an exe file per build variant in build/bin/native.

Run the application

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.

⚠️ Important note: sometimes Windows expects a 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.

About

A simple Kotlin/Native HTTP client with C Interop and libcurl built on Windows.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages