Set value at C pointer in a Julia callback function

I am trying to use Julia with the Gnu Scientific Library (GSL) multimin functionality. This requires definition of three callback functions, one of which passes a C double*. Here is the C function signature:

void my_fdf (const gsl_vector *x, void *params, double *f, gsl_vector *df)

And here is the Julia callback function signature:

function my_fdf(_v::Ptr{GSL.C.gsl_vector}, _params::Ptr{Cvoid}, f::Ptr{Cdouble}, _df::Ptr{GSL.C.gsl_vector})::Cvoid

The problem I have is most likely a new-to-Julia problem - how do I set the value of f? In the C function, I would do something like this:

*f = 123.4

What is the equivalent Julia syntax?

unsafe_store!(f, 123.45)

1 Like

Awesome, thank you for your prompt response.