mirror of
https://github.com/status-im/c-kzg-4844.git
synced 2025-01-11 10:44:23 +00:00
I learned about extern C
This commit is contained in:
parent
2846d0b470
commit
203033613f
@ -7,7 +7,9 @@
|
||||
'ckzg_wrap.cxx',
|
||||
],
|
||||
'include_dirs': ['../../inc', '../../src'],
|
||||
'libraries': ['/Users/coffman@coinbase.com/src/c-kzg/bindings/node.js/libckzg.a'],
|
||||
'libraries': [
|
||||
'/Users/coffman@coinbase.com/src/c-kzg/bindings/node.js/c_kzg_4844.o'
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -3,7 +3,9 @@
|
||||
#include <stdlib.h>
|
||||
#include "ckzg.h"
|
||||
|
||||
void testFunction() {}
|
||||
void testFunction() {
|
||||
return test_function();
|
||||
}
|
||||
|
||||
KZGSettings* loadTrustSetup(const char* file) {
|
||||
KZGSettings* out = (KZGSettings*)malloc(sizeof(KZGSettings));
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* File : ckzg.swg */
|
||||
%module ckzg
|
||||
|
||||
%include <typemaps.i>
|
||||
|
||||
%{
|
||||
#include "ckzg.h"
|
||||
%}
|
||||
|
@ -8,4 +8,5 @@ console.log(kzg);
|
||||
|
||||
console.log('Invoking function...', kzg.testFunction());
|
||||
|
||||
console.log('Invoking freeTrustedSetup...', kzg.freeTrustedSetup(null));
|
||||
let config = {};
|
||||
console.log('Invoking freeTrustedSetup...', kzg.freeTrustedSetup(config));
|
||||
|
@ -2,4 +2,8 @@ INCLUDE_DIRS = ../inc
|
||||
CFLAGS += -O2
|
||||
|
||||
c_kzg_4844.o: c_kzg_4844.c Makefile
|
||||
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) -c $<
|
||||
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) -mmacosx-version-min=10.15 -c $<
|
||||
|
||||
lib: c_kzg_4844.c Makefile
|
||||
clang -Wall -I$(INCLUDE_DIRS) $(CFLAGS) -mmacosx-version-min=10.15 -c c_kzg_4844.c
|
||||
mv c_kzg_4844.o ../bindings/node.js
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void test_function() {}
|
||||
|
||||
|
||||
/**
|
||||
* Wrapped `malloc()` that reports failures to allocate.
|
||||
*
|
||||
|
@ -54,6 +54,12 @@ typedef enum {
|
||||
C_KZG_MALLOC, /**< Could not allocate memory */
|
||||
} C_KZG_RET;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void test_function();
|
||||
|
||||
/**
|
||||
* KZGCommitment and KZGProof can be recovered as 48 bytes
|
||||
*/
|
||||
@ -118,4 +124,8 @@ C_KZG_RET verify_kzg_proof(bool *out,
|
||||
const KZGProof *kzg_proof,
|
||||
const KZGSettings *s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // C_KZG_4844_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user