调用需要sockaddr的C函数

I have a C function that takes a sockaddr pointer.

I've created a syscall.RawSockaddrInet4 object, but I cannot figure out how to cast the address of the object to a C.sockaddr pointer.

I've tried this, (*syscall.RawSockaddr)(unsafe.Pointer(&sa)), but I get an error:

cannot use (*syscall.RawSockaddr)(unsafe.Pointer(&sa)) (type *syscall.RawSockaddr) as type *C.struct_sockaddr in argument to _Cfunc_lib_connect

Any ideas would be much appreciated!

int lib_connect( int sock, enum lib_sock_type type, const struct sockaddr* srv, int srv_sz);

Thanks mkopriva!

(*C.struct_sockaddr)(unsafe.Pointer(&sa))