Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/uvPublic

libuv bindings for Kotlin

License

NotificationsYou must be signed in to change notification settings

datkt/uv

Repository files navigation

libuv bindings for Kotlin/Native.

Installation

Theuv package an be installed with various package managers.

From NPM

$ npm install @datkt/uv

Note:This will installuv intonode_modules/@datkt/uv

Install From Source

$ git clone git@github.com:datkt/uv.git$cd uv$ make build# or make klib$ make install

Prerequisites

Usage

## Compile a program in 'main.kt' and link uv.klib found in node_modules$ konanc -l"$(find node_modules -name uv.klib)" main.kt

wheremain.kt might be

importdatkt.uv.*// entire libuv APIimportkotlinx.cinterop.*// exposes types needed for interopfunmain(args:Array<String>) {if (0!= uv_init()) {throwError("Failed to initialize libuv")  }}

Example

importkotlinx.cinterop.*importdatkt.uv.uv_initimportdatkt.uv.randombytes_bufimportdatkt.uv.randombytes_randomimportdatkt.uv.randombytes_uniformfunmain(args:Array<String>) {val rc= uv_init()if (0!= rc) {throwError("uv_init() != 0")  }}

libuv API

This package binds libuvs entire API and provides aninteropAPI for Kotlin and can be imported from theuv package.

Building

Theuv package can be built from source into various targets.

Kotlin Library

uv.klib, a Kotlin library that can be linked withkonanc can bebuilt from source.

$ make klib

which will producebuild/lib/uv.klib. The library can be installedwithklib by runningmake install

Static Library

libuv.a, a static library that can be linked withkonanc can bebuilt from source.

$ make static

which will producebuild/lib/libuv.a and C header files inbuild/include. The library can be installed into your system byrunningmake install. The path prefix can be set by defining thePREFIX environment ormake variable. It defaults toPREFIX=/usr/local

See Also

License

MIT


[8]ページ先頭

©2009-2025 Movatter.jp