If you want to pass a string, you probably shouldn’t pass it as a struct like this and you probably also shouldn’t pass the struct by value.
Now if for whatever reason the library you use requires this, you need to do exactly what you do in C, i.e. (mem)c[o]py the string from the String (const char*) to the struct. bar is immutable so you need to call memcpy on a Ref of it, i.e. _x = Ref{bar}(); ccall(:memcpy, ...... _x, "hello", length("hello") + 1); x = _x