I try to pass a C struct (PriceEffect **outs) to a C function. When I access the struct in Rust, I receive a SIGSEGV. more specific: the pointer is null. how do I pass the struct properly? I think my example is wrong.
// C
typedef struct {
int status;
double mean;
double d_mean;
double median;
double d_median;
double std_dev;
double d_std_dev;
double variance;
double d_variance;
double *effects;
unsigned int effects_len;
} PriceEffect;
int priceEffect(char *query, char *conn_str, int tls, int time_scope, int precise, PriceEffect **outs);
// go
func test() {
cOut := new(C.PriceEffect)
cOutPtr := unsafe.Pointer(cOut)
C.priceEffect(
cQuery,
cConnStr,
cTls,
cScope,
cPrecision,
(**C.PriceEffect)(cOutPtr)) // whats wrong here?
defer C.free(cOutPtr)
}