1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

Move function definitions to source file (ffi)

This commit is contained in:
dark64 2019-11-11 14:41:02 +01:00
parent 012b5ee757
commit 97f9cc6e2b
3 changed files with 13 additions and 8 deletions

View file

@ -55,6 +55,7 @@ fn main() {
.include(libsnark_source_path.join("depends/libff"))
.include(libsnark_source_path.join("depends/libfqfft"))
.define("CURVE_ALT_BN128", None)
.file("lib/ffi.cpp")
.file("lib/util.cpp")
.file("lib/gm17.cpp")
.file("lib/pghr13.cpp")

10
zokrates_core/lib/ffi.cpp Normal file
View file

@ -0,0 +1,10 @@
#include "ffi.hpp"
void __alloc(buffer_t* buffer, size_t length) {
buffer->data = (uint8_t*)malloc(length);
buffer->length = length;
}
void __free(uint8_t* ptr) {
free(ptr);
}

View file

@ -23,14 +23,8 @@ struct proof_result_t {
proof_result_t(buffer_t& proof_buf) : proof(proof_buf) { }
};
void __alloc(buffer_t* buffer, size_t length) {
buffer->data = (uint8_t*)malloc(length);
buffer->length = length;
}
void __free(uint8_t* ptr) {
free(ptr);
}
void __alloc(buffer_t* buffer, size_t length);
void __free(uint8_t* ptr);
#ifdef __cplusplus
} // extern "C"