Skip to content

Commit

Permalink
Try to fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
quelgar committed Jan 19, 2024
1 parent 033ff29 commit e5a4044
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Scala Native bindings for libuv

> Handcrafted, artisanal Scala Native bindings for libuv.
**scala-uv** is a Scala Native library that provides Scala bindings for [libuv](https://libuv.org), which is a multi-platform asynchronous IO library written in C. libuv was originally developed for Node.js, but it's also used by other software projects.

Only Scala 3 is supported at this time.
Only Scala 3 is supported.

## Getting it

Expand All @@ -12,15 +14,15 @@ libraryDependencies += "io.github.quelgar" %%% "scala-uv" % "0.0.1"

## Current status

Very early days, only some of the APIs are bound. What works so far:
Very early days, most of the APIs have bindings, but not all. Many are not tested at all. What I've tried so far:

* Error handling
* Event loop
* Async callbacks
* Read and write files
* TCP client and server

But the API is still in flux.
But many details of the API are still in flux.

## Examples

Expand Down Expand Up @@ -99,12 +101,6 @@ uv_write(writeReq, stream, buf, 1.toUInt, onWrite).onFail {

While the `Zone` memory allocation API from Scala Native is very nice, it's not useful when the memory is freed in a different callback, as there won't be a shared lexical scope. So `mallocCString` converts a Scala string to a C string, allocating the memory the old-fashioned way.

### Other UvUtils methods

* allocate memory for requests
* allocate memory for handles
* allocate, use and free file system requests

---

Copyright 2024 Lachlan O'Dea
Expand Down
10 changes: 6 additions & 4 deletions src/main/scala/scalauv/errors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ object ErrorCodes {
val EFTYPE: ErrorCode = uv_scala_errorcode_EFTYPE()
val EILSEQ: ErrorCode = uv_scala_errorcode_EILSEQ()
val ESOCKTNOSUPPORT: ErrorCode = uv_scala_errorcode_ESOCKTNOSUPPORT()
val ENODATA: ErrorCode = uv_scala_errorcode_ENODATA()
val EUNATCH: ErrorCode = uv_scala_errorcode_EUNATCH()

// these require libuv >= 1.46 but Ubuntu 22 LTS only has 1.43
// val ENODATA: ErrorCode = uv_scala_errorcode_ENODATA()
// val EUNATCH: ErrorCode = uv_scala_errorcode_EUNATCH()

}

Expand Down Expand Up @@ -180,7 +182,7 @@ private[scalauv] object errors {
def uv_scala_errorcode_EFTYPE(): ErrorCode = extern
def uv_scala_errorcode_EILSEQ(): ErrorCode = extern
def uv_scala_errorcode_ESOCKTNOSUPPORT(): ErrorCode = extern
def uv_scala_errorcode_ENODATA(): ErrorCode = extern
def uv_scala_errorcode_EUNATCH(): ErrorCode = extern
// def uv_scala_errorcode_ENODATA(): ErrorCode = extern
// def uv_scala_errorcode_EUNATCH(): ErrorCode = extern

}

0 comments on commit e5a4044

Please sign in to comment.