C# interface

This commit is contained in:
Dankrad Feist 2022-10-01 18:03:52 +01:00
parent c56461e3a5
commit bc89288ca7
No known key found for this signature in database
GPG Key ID: 6815E6A20BEBBABA
3 changed files with 24 additions and 1 deletions

11
min-bindings/C#/Makefile Normal file
View File

@ -0,0 +1,11 @@
INCLUDE_DIRS = .. ../../min-src ../../inc
test: tests.cs ckzg.dll.so
mcs -langversion:5 -optimize+ tests.cs ckzg.cs -r:System.Numerics.dll
./tests.exe
ckzg.dll.so: c_kzg_4844_wrap.c ../../min-src/c_kzg_4844.o ../../lib/libblst.a
clang -O -Wall -shared -fPIC -Wl,-Bsymbolic -I${INCLUDE_PY} ${addprefix -I,${INCLUDE_DIRS}} -o $@ $^
c_kzg_4844_wrap.c ckzg.cs: ../c_kzg_4844.swg
swig -DSWIGWORDSIZE64 -O -Wall -csharp -outcurrentdir -namespace ckzg -outfile ckzg.cs $<

10
min-bindings/C#/tests.cs Normal file
View File

@ -0,0 +1,10 @@
using System;
using System.Text;
using ckzg;
class PoC {
private static void Main(string[] args)
{
Console.WriteLine("OK");
}
}

View File

@ -77,6 +77,7 @@
%include "../min-src/c_kzg_4844.h"
%include "../inc/blst.h"
#if defined(SWIGPYTHON)
%pythoncode %{
# Helper functions
@ -121,3 +122,4 @@ def _frompybytes(b):
bytes.frompybytes = _frompybytes
%}
#endif