G
Guest
Howdy,
I have a legacy DLL for which I have a problem marshalling a parameter type
of char**.
The function header (C++) is as so;
extern "C" __declspec(dllexport) int __stdcall GetChildren(GetChildrenParm
*, Results *);
typedef struct _GetChildrenParm {
char *id_parent;
int num_results_max;
} GetChildrenParm;
typedef struct _Results {
char **id_object;
int num_results;
} Results;
My current C# code looks like;
[DllImport("objapi.dll")]
extern static int GetChildren (ref GetChildrenParm inParam, ref Results
outParam);
struct GetChildrenParm
{
string id_parent;
int num_results_max;
public ObjGetFolderChildrenParm(
string _id_parent,
int _num_results_max)
{
id_parent = _id_parent;
num_results_max = _num_results_max;
}
};
Marshalling the GetChildrenParm (inParam) is no problem, but marshalling the
Results (outParam) is giving me a headache due to the char** datatype within
the structure.
Any ideas how I can make this work? I can't find any examples anywhere of
Marshalling a char** type, let alone one within a struct.... ???
I have a legacy DLL for which I have a problem marshalling a parameter type
of char**.
The function header (C++) is as so;
extern "C" __declspec(dllexport) int __stdcall GetChildren(GetChildrenParm
*, Results *);
typedef struct _GetChildrenParm {
char *id_parent;
int num_results_max;
} GetChildrenParm;
typedef struct _Results {
char **id_object;
int num_results;
} Results;
My current C# code looks like;
[DllImport("objapi.dll")]
extern static int GetChildren (ref GetChildrenParm inParam, ref Results
outParam);
struct GetChildrenParm
{
string id_parent;
int num_results_max;
public ObjGetFolderChildrenParm(
string _id_parent,
int _num_results_max)
{
id_parent = _id_parent;
num_results_max = _num_results_max;
}
};
Marshalling the GetChildrenParm (inParam) is no problem, but marshalling the
Results (outParam) is giving me a headache due to the char** datatype within
the structure.
Any ideas how I can make this work? I can't find any examples anywhere of
Marshalling a char** type, let alone one within a struct.... ???