c# - Plnvoke Struct Field that is a char** impossible? Have to use unsafe code -
we have unsafe c# code leveraging c dll setups huge struct. think they're insane , want change use pinvoke instead has pointer char pointer messing me up. e.g. native code:
struct{ ... char** args; int argcount; ... } nativestruct;
if weren't marshalling struct , passing arguments native method use:
[dllimport("nativelibrary.dll")] nativemethod(ref string args, int argcount);
but this:
struct{ string args; int argcount; }
just marshals in char* not char**. you're not allowed use ref/out on struct field member, no unmanagedtype seems applicable. seems impossible short of using unsafe code, it?