I have tons of C code that I need to use in C#. Example:
long foo(char** mystring);
void free_string(char* mystring);
foo()
is using malloc()
to allocate memory for mystring
. I have tried several ways of calling this function from C#, but I am failing to free mystring
. Can you please give me some guidelines on how to call foo()
so that I can later free mystring
?
For example, if char**
is represented by StringBuilder[]
, then how can I use it to be freed in free_string()
?