I call a method from .so lib written in C using C#. That's the C# code that is used:
    [DllImport("liblab.so")]
    
    static extern char[] entrance(
        [MarshalAs(UnmanagedType.LPWStr)]string path, 
        [MarshalAs(UnmanagedType.LPWStr)]string command);
    static void Main(string[] args)
    {
            command = Console.ReadLine();
            output = entrance(path, command).ToString();
            Console.WriteLine(output);
 }
(path is a hardcoded string there).
And that's the code that is called in C:
char* entrance(char* path, char* command1){
struct state* fs_state = setup(path);
if (fs_state != NULL){
    fgets_wrapper(command1, LINE_MAX, stdin);
    struct commands command = parse_command(command1);
    return execute_operation(command, fs_state);
}
else return "No data";
}
Calling from C# function entrance causes Unhandled exception. System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'return value': Invalid managed/unmanaged type combination. error. I tried different encodings, but neither of them worked.
How can I solve that?