You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rngxx/src/capi-bridge.h

33 lines
1.2 KiB

// Bridges the working TU `capi-bridge.cpp`, which handles interfacing with rngxx's C++ API, and the C API shim TU defined in `capi.c`
// This file must be useable by both C and C++ compilers, and everything here must have C linkage
//
// Other headers shouldn't be included here. The only ones included are included for the types they define
#ifndef _RNG_CAPI_BRIDGE_H
#define _RNG_CAPI_BRIDGE_H
#define _RNGXX_IMPL_ONLY_TYPES
#include <rngxx.h>
#undef _RNGXX_IMPL_ONLY_TYPES
#include <common.h>
#define RNG_IMPL(name) _rng__internal_ ## name
#ifdef __cplusplus
extern "C" {
#endif
rng_t* RNG_IMPL(mkdriver)(enum rng_kind kind, const u64* restrict seed) _export(internal);
int RNG_IMPL(mnext)(rng_t* engine, void* restrict output, const struct rng_next_opt* restrict opt) _export(internal);
int RNG_IMPL(m_allocsz_for)(enum rng_next_type ty, size_t* restrict size, size_t* restrict align) _export(internal);
rng_t* RNG_IMPL(dynctor_trycall)(const char* name, const void* seed) _export(internal);
struct rng_dyn_ctor* RNG_IMPL(dynctor_refer)(const char* name) _export(internal);
rng_t* RNG_IMPL(dynctor_callref)(struct rng_dyn_ctor* ptr, const void* seed) _export(internal);
#ifdef __cplusplus
}
#endif
#endif /* _RNG_CAPI_BRIDGE_H */