https://github.com/furesoft/lakshmi
Lakshmi is a source generator for c# to make working with extism pdk more idiomatic c#
https://github.com/furesoft/lakshmi
csharp dotnet extism generator wasm
Last synced: 3 months ago
JSON representation
Lakshmi is a source generator for c# to make working with extism pdk more idiomatic c#
- Host: GitHub
- URL: https://github.com/furesoft/lakshmi
- Owner: furesoft
- License: gpl-3.0
- Created: 2025-03-26T14:57:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-10T13:45:09.000Z (about 1 year ago)
- Last Synced: 2025-10-12T14:08:18.667Z (8 months ago)
- Topics: csharp, dotnet, extism, generator, wasm
- Language: C#
- Homepage: https://lakshmi-rose.vercel.app
- Size: 78.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lakshmi
Lakshmi is a source generator for c# to make working with extism pdk more the idiomatic c# way
[](https://www.codefactor.io/repository/github/furesoft/lakshmi)


[](https://www.gnu.org/licenses/gpl-3.0)


# Installation
1. Install the nuget package with `dotnet add package Lakshmi`
2. Use it
# Usage
To work with Lakshmi you have to reference the dotnet extism pdk. Using extism forces you to write a more native like c#. Lashmi provides a source generator to use higher level types.
## Importing functions
```csharp
record MyPoint(int x, int y);
class Test {
[Import("host", Entry="add")]
public partial int Add(int a, int b);
[Import("host", Entry="getPoint")]
public partial MyPoint GetPoint();
}
```
## Exporting functions
```csharp
record ExtensionInfo(string author, string[] allowed_hosts);
class Test {
[Export("register")]
public static ExtensionInfo Register() {
return new ExtensionInfo("furesoft", []);
}
}
```
# How does it work?
Under the Hood Lakshma uses a source generator that generates all the necessary temproary classes and builds a type shape, see [PolyType](https://github.com/eiriktsarpalis/PolyType), to make sure the deserialization works for aot. Imported/exported methods are wrapped in special generated methods.