- Notifications
You must be signed in to change notification settings - Fork0
datkt/uv
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
libuv bindings for Kotlin/Native.
Theuv
package an be installed with various package managers.
$ npm install @datkt/uv
Note:This will installuv intonode_modules/@datkt/uv
$ git clone git@github.com:datkt/uv.git$cd uv$ make build# or make klib$ make install
- Kotlin/Native and the
konanc
command line program. - make
## 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") }}
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") }}
This package binds libuvs entire API and provides aninteropAPI for Kotlin and can be imported from theuv
package.
Theuv
package can be built from source into various targets.
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
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
- https://libuv.gitbook.io/doc
- https://github.com/jedisct1/libuv
- https://github.com/uv-friends/uv-native
MIT
About
libuv bindings for Kotlin