Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions FURPS/application/nim_ffi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Nim-FFI FURPS

## Functionality

1. Provides the core logic needed to expose any synchronous or asynchronous Nim library to a C-FFI library.

## Usability

1. Introduce new pragma definitions, such as `{.ffi.}`, to appropriately annotate types and procedures.
2. Any Nim project can use it and can be installed using Nimble,
similarly to how nim-chronos is imported.
3. The interaction with the exposed C library can be done using JSON.
4. The interaction with the exposed C library can be done using protobuf.

## Reliability

1. Nim-FFI does not leak memory.
2. The exposed C library never hangs when working asynchronously.

## Performance

## Supportability

1. The exposed C library can be used in Golang.
2. The exposed C library can be used in Rust.
3. The exposed C library can be used in Python.

## + (Privacy, Anonymity, Deployments)

1. `nwaku` repository uses `nim-ffi` to expose the existing `libwaku` functionality.

34 changes: 33 additions & 1 deletion draft-roadmap/nim_usage_improvements.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Estimated date of completion**: 19 Dec

**Resources Required for 2025H2**:
- 1 nwaku eng for 2 months
- 2 nwaku eng for 3 months
- Support from Vac/Nim team

Improve usage of Nim related tooling and design patterns by proceedings with PoCs to discover potential gains and caveats.
Expand Down Expand Up @@ -69,6 +69,38 @@ Note: maybe taken over by Vac-Nim

- U7. When wrapping the C API, a protobuf definition can be used to generate native types for the host language (PoC).

**Checklist**:
- [ ] Specs: link to specs and/or API definition
- [ ] Code: link to GitHub issues/PRs/Epic
- [ ] Dogfood: link to dogfooding session/artefact
- [ ] Docs: links to README.md or docs.waku.org (TBD)


### Create nim-ffi, a library to easily exposes c-bindings from Nim

**Owner**: nwaku

**Feature**: [Nim FFI](/FURPS/application/nim_ffi.md)

**FURPS**:

- F1. Provides the core logic needed to expose any synchronous or asynchronous Nim library to a C-FFI library.

- U1. Introduce new pragma definitions, such as `{.ffi.}`, to appropriately annotate types and procedures.
- U2. Any Nim project can use it and can be installed using Nimble,
similarly to how nim-chronos is imported.
- U3. The interaction with the exposed C library can be done using JSON.
- U4. The interaction with the exposed C library can be done using protobuf.

- R1. Nim-FFI does not leak memory.
- R2. The exposed C library never hangs when working asynchronously.

- S1. The exposed C library can be used in Golang.
- S2. The exposed C library can be used in Rust.
- S3. The exposed C library can be used in Python.

- +1. `nwaku` repository uses `nim-ffi` to expose the existing `libwaku` functionality.

**Checklist**:
- [ ] Specs: link to specs and/or API definition
- [ ] Code: link to GitHub issues/PRs/Epic
Expand Down